Aspose.Slides for Python via .NET是一個強大的類庫,用於處理或處理演示文稿。使用此產品,應用程序和開發人員無需第三方應用程序或依賴項即可閱讀、編輯或操作以及轉換 PowerPoint 演示文稿(PPT、PPTX)和其他格式 (ODP) 的演示文稿。
Aspose.Slides for Python via。NET提供了這些流行的功能:
Python 是一種非常流行的語言,在常規應用程序、Web 開發、研究和學術任務、數據分析等中得到了廣泛的應用。因此,Aspose.Slides團隊很自豪能夠通過 .NET 為 Python 提供 Aspose.Slides到 python 社區。
從模板創建或克隆幻燈片
通過 API 處理 PowerPoint 表格
應用或刪除形狀上的保護
將 Excel 圖表作為 OleObjects 添加到幻燈片
支持鏈接的 OleObjects
從數據庫生成演示文稿
保護演示文稿和生成的 PDF
在物理打印機上打印演示文稿
創建和自定義圖表
在下面給出的示例中,我們在演示文稿的第一張幻燈片中添加了一行。
import aspose.slides as slides
# Instantiate a Presentation object that represents a presentation file
with slides.Presentation() as presentation:
slide = presentation.slides[0]
slide.shapes.add_auto_shape(slides.ShapeType.LINE, 50, 150, 300, 0)
presentation.save("NewPresentation_out.pptx", slides.export.SaveFormat.PPTX)
此 Python 代碼向您展示瞭如何合併演示文稿:
import aspose.slides as slides
with slides.Presentation("Presentation1.pptx") as pres1:
with slides.Presentation("Presentation2.pptx") as pres2:
for slide in pres2.slides:
pres1.slides.add_clone(slide)
pres1.save("combined.pptx", slides.export.SaveFormat.PPTX)
此 Python 代碼演示了 PDF 到 PowerPoint 的轉換過程:
import aspose.slides as slides
with slides.Presentation() as pres:
pres.slides.remove_at(0)
pres.slides.add_from_pdf("welcome-to-powerpoint.pdf")
pres.save("OutputPresentation.pptx", slides.export.SaveFormat.PPTX)
以下示例顯示如何使用默認選項將 PowerPoint PPT、PPTX 和 OpenOffice ODP 文檔轉換為 PDF 文檔。默認選項以最高質量級別創建 PDF 文檔
import aspose.slides as slides
# Instantiate a Presentation object that represents a PPT file
presentation = slides.Presentation("PowerPoint.ppt")
# Save the presentation as PDF
presentation.save("PPT-to-PDF.pdf", slides.export.SaveFormat.PDF)
以下示例向您展示如何將 PowerPoint PPT、PPTX 和 OpenOffice ODP 文檔轉換為一組 JPEG 圖像。
import aspose.slides as slides
import aspose.pydrawing as drawing
pres = slides.Presentation("pres.pptx")
for sld in pres.slides:
bmp = sld.get_thumbnail(1, 1)
bmp.save("Slide_{num}.jpg".format(num=str(sld.slide_number)), drawing.imaging.ImageFormat.jpeg)