# Python PowerPoint API。 Python PPTX，來自 Aspose.Slides 的 PPT

> 用於處理 Microsoft PowerPoint 文件的 Python 庫。 Python PPTX，PPT。創建編輯轉換 PPT PPTX PPS POT PPSX PPTM PPSM POTX POTM ODP PDF 和更多格式。

Source: https://products.aspose.com/slides/zh-hant/python-net/
Updated: 2026-08-11



<p><strong>Aspose.Slides for Python via .NET</strong> 是一個強大的類庫，用於處理或處理演示文稿。使用此產品，應用程序和開發人員無需第三方應用程序或依賴項即可閱讀、編輯或操作以及轉換 PowerPoint 演示文稿（PPT、PPTX）和其他格式 (ODP) 的演示文稿。 </p>

<p><strong>Aspose.Slides for Python via。 NET</strong> 提供了這些流行的功能：</p>
<ul>
    <li>加載、打開和查看演示文稿。</li>
    <li>編輯演示文稿。</li>
    <li>將演示文稿轉換為 PDF、Word、JPG、HTML、GIF、SVG 和許多其他格式。</li>
    <li>渲染和打印演示文稿。</li>
    <li>加密和解密演示文稿；密碼保護演示文稿和刪除密碼。</li>
    <li>操作演示實體，例如母版幻燈片、形狀、圖表、圖片幀、音頻幀、視頻幀、OLE、VBA 宏、動畫等。</li>
    <li>還有更多功能。</li>
</ul>

<p>Python 是一種非常流行的語言，在常規應用程序、Web 開發、研究和學術任務、數據分析等方面得到了廣泛的應用。因此，<strong>Aspose.Slides</strong> 團隊很自豪地提供 <strong>Aspose.Slides</strong> strong>Aspose.Slides for Python via .NET</strong> 到 python 社區。 </p>

<div class="diagram1 d1-python">
 <div class="d1-row">
  <div class="d1-col d1-left">
   <header>
    <i class="fa fa-table">
    </i>
    數據處理
   </header>
   <ul>
    <li>
管理圖表
    </li>
    <li>
管理 SmartArts
    </li>
    <li>
管理 PowerPoint 形狀
    </li>
    <li>
管理 ActiveX 控件
    </li>
    <li>
管理 OleObjects
    </li>
   </ul>
   <header>
    <i class="fa fa-text-width">
    </i>
    文本和段落
   </header>
   <ul>
    <li>
處理文本和格式
    </li>
    <li>
處理超鏈接文本
    </li>
    <li>
設置佔位符類型
    </li>
   </ul>
  </div>

  <div class="d1-col d1-right">
   <header>
    <i class="fa fa-cog">
    </i>
    圖形和多媒體
   </header>
   <ul>
    <li>
管理幻燈片過渡
    </li>
    <li>
管理動畫效果
    </li>
    <li>
將連接器添加到形狀
    </li>
    <li>
旋轉和翻轉形狀
    </li>
    <li>
管理形狀的線型
    </li>
   </ul>
  </div>

 </div>

 <div class="d1-logo">
  <img width="70" height="75" alt="Python PowerPoint Processing APIs" src="https://www.aspose.cloud/templates/aspose/img/products/slides/aspose_slides-for-python.svg"/>
  <header>
   Aspose.Slides
  </header>
  <footer>
   <small>
    <em>
     for
    </em>
   </small>
   Python
   <em>via .NET</em>
  </footer>
 </div>

</div>

<div class="diagram1 d1-python">
 <div class="d1-row">
  <div class="d1-col d1-left">
   <header>
    <i class="fa fa-cubes">
    </i>
    視窗
   </header>
   <ul>
    <li>
Windows 7（x64、x86）
    </li>
    <li>
Windows 8、8.1（x64、x86）
    </li>
    <li>
Windows 10（x64、x86）
    </li>
	<li>
和別的
	</li>
   </ul>
  </div>

  <div class="d1-col d1-right">
   <header>
    <i class="fa fa-cubes">
    </i>
    Linux
   </header>
   <ul>
    <li>
Ubuntu
    </li>
    <li>
OpenSUSE
    </li>
    <li>
中央操作系統
    </li>
	<li>
和別的
	</li>
   </ul>
  </div>

 </div>

 <div class="d1-logo">
  <img width="70" height="75" alt="Presentation APIs for Python" src="https://www.aspose.cloud/templates/aspose/img/products/slides/aspose_slides-for-python.svg"/>
  <header>
   Aspose.Slides
  </header>
  <footer>
   <small>
    <em>
     for
    </em>
   </small>
   Python
   <em>via .NET</em>
  </footer>
 </div>

</div>

<div class="diagram1 d2 d1-python">
 <div class="d1-row">
  <div class="d1-col d1-left">
   <header>
    <i class="fa fa-arrows-v">
    </i>
    輸入輸出
   </header>
   <ul>
    <li>
     <b>
微軟PowerPoint：
     </b>
     PPT, PPTX, PPS, POT, PPSX, PPTM, PPSM, POTX, POTM
    </li>
    <li>
     <b>
開發辦公室：
     </b>
     ODP
    </li>
    <li>
     <b>
固定佈局：
     </b>
     PDF
    </li>
   </ul>
  </div>

  <div class="d1-col d1-right">
   <header>
    <i class="fa fa-mail-forward">
    </i>
    僅輸出
   </header>
   <ul>
    <li>
     <b>
固定佈局：
     </b>
     PDF, PDF/A, XPS
    </li>
    <li>
     <b>
圖片：
     </b>
     JPEG, PNG, BMP, TIFF, GIF
    </li>
    <li>
SVG
    </li>
    <li>
     <b>
網站：
     </b>
     HTML
    </li>
   </ul>
  </div>

 </div>

 <div class="d1-logo">
  <img width="70" height="75" alt="PowerPoint Presentation API" src="https://www.aspose.cloud/templates/aspose/img/products/slides/aspose_slides-for-python.svg"/>
  <header>
   Aspose.Slides
  </header>
  <footer>
   <small>
    <em>
     for
    </em>
   </small>
   Python
   <em>via .NET</em>
  </footer>
 </div>

</div>

<div class="container-fluid features-section bg-gray singleproduct">
 <a class="anchor" id="features" name="features">
 </a>
 <div class="row">
  <div class="container">
   <h2 class="pr-ft">
    高級 Python PowerPoint API 功能
   </h2>
   <p>
   </p>
   <div class="col-lg-4">
    <em class="fa fa-copy ico-blue fa-2x col-lg-2">
    </em>
    <p class="col-lg-10">
     從模板創建或克隆幻燈片
    </p>
   </div>
   <div class="col-lg-4">
    <em class="fa fa-signal ico-blue fa-2x col-lg-2">
    </em>
    <p class="col-lg-10">
     通過 API 處理 PowerPoint 表格
    </p>
   </div>
   <div class="col-lg-4">
    <em class="fa fa-cogs ico-blue fa-2x col-lg-2">
    </em>
    <p class="col-lg-10">
     應用或刪除形狀上的保護
    </p>
   </div>
   <div class="col-lg-4">
    <em class="fa fa-lock ico-blue fa-2x col-lg-2">
    </em>
    <p class="col-lg-10">
     將 Excel 圖表作為 OleObjects 添加到幻燈片
    </p>
   </div>
   <div class="col-lg-4">
    <em class="fa fa-print ico-blue fa-2x col-lg-2">
    </em>
    <p class="col-lg-10">
     支持鏈接的 OleObjects
    </p>
   </div>
   <div class="col-lg-4">
    <em class="fa fa-text-width ico-blue fa-2x col-lg-2">
    </em>
    <p class="col-lg-10">
     從數據庫生成演示文稿
    </p>
   </div>
   <div class="col-lg-4">
    <em class="fa fa-unlock-alt ico-blue fa-2x col-lg-2">
    </em>
    <p class="col-lg-10">
     保護演示文稿和生成的 PDF
    </p>
   </div>
   <div class="col-lg-4">
    <em class="fa fa-print ico-blue fa-2x col-lg-2">
    </em>
    <p class="col-lg-10">
     在物理打印機上打印演示文稿
    </p>
   </div>
   <div class="col-lg-4">
    <em class="fa fa-font ico-blue fa-2x col-lg-2">
    </em>
    <p class="col-lg-10">
     創建和自定義圖表
    </p>
   </div>
   <div class="col-lg-12">
    <h2 class="h2title">
     系統要求
    </h2>
    <ul>
	  <li>與 Python 3.5、3.6、3.7、3.8 和 3.9 兼容</li>
	  <li>如果您在 Linux 上編寫 Python 代碼，請查看 <a href="https://docs.aspose.com/slides/python-net/system-requirements/">Linux 的附加要求</a></li>
    </ul>
   </div>
   <div class="col-lg-12">
    <h2 class="h2title">
     如何安裝
    </h2>
    <p>使用 <strong>pip</strong> 從 <a href="https://pypi.org/project/aspose.slides/">PyPI 存儲庫</a> 安裝我們的 Python 庫以進行演示處理</p>:
	<pre><code>pip install aspose.slides</code></pre>
   </div>
    <div class="col-lg-12">
        <h2 class="h2title">創建新的 PowerPoint 演示文稿。 Python PPTX、PPT 或 ODP</h2>
        <p>在下面給出的示例中，我們在演示文稿的第一張幻燈片中添加了一行。</p>
        <pre>
            <code class="python">
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)
            </code>
        </pre>
    </div>
    <div class="col-lg-12">
        <h2 class="h2title">合併演示文稿：Python PPTX、PPT 或 ODP</h2>
        <p>此 Python 代碼向您展示瞭如何合併演示文稿：</p>
        <pre>
            <code class="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)
            </code>
        </pre>
    </div>
    <div class="col-lg-12">
        <h2 class="h2title"> 從 PDF 導入演示文稿：Python PPTX、PPT 或 ODP</h2>
        <p>此 Python 代碼演示了 PDF 到 PowerPoint 的轉換過程：</p>
        <pre>
            <code class="python">
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)
            </code>
        </pre>
    </div>
    <div class="col-lg-12">
        <h2 class="h2title">使用默認選項將 PowerPoint 轉換為 PDF：Python PPTX、PPT 或 ODP 到 PDF</h2>
        <p>此 Python 代碼向您展示如何使用默認選項將 PowerPoint PPT、PPTX 和 OpenOffice ODP 文檔轉換為 PDF 文檔。生成的文件是最高質量級別的 PDF 文檔</p>
        <pre>
            <code class="python">
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)
            </code>
        </pre>
    </div>
    <div class="col-lg-12">
        <h2 class="h2title">將 PowerPoint 轉換為 JPG：Python PPTX、PPT 或 ODP 轉換為 JPEG</h2>
        <p>以下示例向您展示如何將 PowerPoint PPT、PPTX 和 OpenOffice ODP 文檔轉換為一組 JPEG 圖像。</p>
        <pre>
            <code class="python">
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)
            </code>
        </pre>
    </div>
  </div>
 </div>
</div>

> 我們發現 Aspose.Slides 易於使用並且在我們的服務器上運行良好。我們發現它們滿足了動態生成文件的重要需求，以將我們的範圍擴展到傳統的 Web 應用程序之外。
>
> — Rick Joi | Workplace Dynamics, UK

> 該產品按廣告宣傳，文檔易於理解，支持論壇是我們需要的所有幫助。我們部署的最終解決方案大大超出了我們最初的預期。
>
> — Bruce Brien | Stratascope Inc, USA
