Spire.Presentation for Python 9.11.1 现已正式发布。最新版本支持获取 section 中的幻灯片。此外,一些已知问题也在本次升级中被成功修复,例如使用 SlideCountPerPageForPrint 和 ContainHiddenSlides 报错的问题。详情请阅读以下内容。
新功能:
- 支持获取 section 中的幻灯片。
- 支持获取 SmartArt 的 Left 和 Top 值。
- 支持了 DisplayFormat 属性。
ppt = Presentation()
ppt.LoadFromFile(inputFile)
section=ppt.SectionList[0]
slides=section.GetSlides()
sb = [] i=0 for slide in slides:
sb.append("SlideID:"+str(slides[i].SlideID))
i=i+1
File.AppendAllText(outputFile, sb)
ppt.Dispose
# Create a Presentation oject
presentation = Presentation()
# Load a PowerPoint document
presentation.LoadFromFile(inputFile)
sb = []
# Get custom document properties
for shape in presentation.Slides[0].Shapes:
if isinstance(shape, ISmartArt):
sa = shape if isinstance(shape, ISmartArt) else None
sb.append("left: " + str(sa.Left))
sb.append("top: " + str(sa.Top))
File.AppendAllText(outputFile, sb)
presentation.Dispose()
# Create a Presentation oject
presentation = Presentation()
presentation.LoadFromFile(inputFile)
shape = presentation.Slides[0].Shapes[0]
textrange = shape.TextFrame.Paragraphs[0].TextRanges[0]
displayformat = textrange.DisplayFormat
sb = []
sb.append("text :" + str(textrange.Text))
sb.append("is bold :" + str(displayformat.IsBold))
sb.append("is italic :" + str(displayformat.IsItalic))
sb.append("latin_font FontName = :" + str(displayformat.LatinFont.FontName))
File.AppendAllText(outputFile, sb)
presentation.Dispose()
问题修复:
- 修复了使用 SlideCountPerPageForPrint 和 ContainHiddenSlides 报错的问题。
- 修复了 PPT 转 PDF 内容布局不正确的问题。
- 优化了 PPT 转图片的耗时问题。
获取 Spire.Presentation for Python 9.11.1 请点击:
https://www.e-iceblue.cn/Downloads/Spire-Presentation-Python.html