# API PowerPoint trong Python. Python PPTX, PPT từ Aspose.Slides

> Thư viện Python để làm việc với các tệp Microsoft PowerPoint. Python PPTX, PPT. Tạo chỉnh sửa chuyển đổi PPT PPTX PPS POT PPSX PPTM PPSM POTX POTM ODP PDF và nhiều định dạng khác.

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



<p><strong> Aspose.Slides dành cho Python qua .NET </strong> là một thư viện lớp mạnh mẽ để làm việc với hoặc xử lý các bản trình bày. Sử dụng sản phẩm này, các ứng dụng và nhà phát triển có thể đọc, chỉnh sửa hoặc thao tác và chuyển đổi bản trình bày PowerPoint (PPT, PPTX) và bản trình bày ở các định dạng khác (ODP) mà không cần ứng dụng hoặc phụ thuộc của bên thứ ba. </p>

<p>Thông qua <strong> Aspose.Slides cho Python. NET </strong> cung cấp các tính năng phổ biến sau:</p>
<ul>
    <li>Đang tải, mở và xem bản trình bày.</li>
    <li>Chỉnh sửa bài thuyết trình.</li>
    <li>Chuyển đổi bản trình bày sang PDF, Word, JPG, HTML, GIF, SVG và nhiều định dạng khác.</li>
    <li>Kết xuất và in các bài thuyết trình.</li>
    <li>Mã hóa và giải mã các bài thuyết trình; các bài thuyết trình bảo vệ bằng mật khẩu và xóa mật khẩu.</li>
    <li>Thao tác các thực thể bản trình bày, chẳng hạn như trang trình bày chính, hình dạng, biểu đồ, khung ảnh, khung âm thanh, khung video, macro OLE, VBA, hoạt ảnh, v.v.</li>
    <li>Và nhiều tính năng khác.</li>
</ul>

<p>Python là một ngôn ngữ rất phổ biến được sử dụng nhiều trong các ứng dụng thông thường, phát triển web, nhiệm vụ nghiên cứu và học tập, phân tích dữ liệu, v.v. Vì lý do này, nhóm <strong> Aspose.Slides </strong> tự hào cung cấp < strong> Aspose.Slides cho Python qua .NET </strong> tới cộng đồng python. </p>

<div class="diagram1 d1-python">
 <div class="d1-row">
  <div class="d1-col d1-left">
   <header>
    <i class="fa fa-table">
    </i>
    Xử lí dữ liệu
   </header>
   <ul>
    <li>
Quản lý biểu đồ
    </li>
    <li>
Quản lý SmartArts
    </li>
    <li>
Quản lý hình dạng PowerPoint
    </li>
    <li>
Quản lý các điều khiển ActiveX
    </li>
    <li>
Quản lý OleObjects
    </li>
   </ul>
   <header>
    <i class="fa fa-text-width">
    </i>
    Văn bản và Đoạn văn
   </header>
   <ul>
    <li>
Thao tác với văn bản và định dạng
    </li>
    <li>
Thao tác văn bản siêu liên kết
    </li>
    <li>
Đặt loại trình giữ chỗ
    </li>
   </ul>
  </div>

  <div class="d1-col d1-right">
   <header>
    <i class="fa fa-cog">
    </i>
    Đồ họa & Đa phương tiện
   </header>
   <ul>
    <li>
Quản lý chuyển đổi trang trình bày
    </li>
    <li>
Quản lý hiệu ứng hoạt ảnh
    </li>
    <li>
Thêm trình kết nối vào hình dạng
    </li>
    <li>
Xoay & lật hình
    </li>
    <li>
Quản lý kiểu đường kẻ của hình dạng
    </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>
    các cửa sổ
   </header>
   <ul>
    <li>
Windows 7 (x64, x86)
    </li>
    <li>
Windows 8, 8.1 (x64, x86)
    </li>
    <li>
Windows 10 (x64, x86)
    </li>
	<li>
và những người khác
	</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>
CentOS
    </li>
	<li>
và những người khác
	</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>
    Đầu ra đầu vào
   </header>
   <ul>
    <li>
     <b>
Microsoft Powerpoint:
     </b>
     PPT, PPTX, PPS, POT, PPSX, PPTM, PPSM, POTX, POTM
    </li>
    <li>
     <b>
Mở văn phòng:
     </b>
     ODP
    </li>
    <li>
     <b>
Bố cục cố định:
     </b>
     PDF
    </li>
   </ul>
  </div>

  <div class="d1-col d1-right">
   <header>
    <i class="fa fa-mail-forward">
    </i>
    Chỉ đầu ra
   </header>
   <ul>
    <li>
     <b>
Bố cục cố định:
     </b>
     PDF, PDF/A, XPS
    </li>
    <li>
     <b>
Hình ảnh:
     </b>
     JPEG, PNG, BMP, TIFF, GIF
    </li>
    <li>
SVG
    </li>
    <li>
     <b>
Web:
     </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">
    Tính năng API PowerPoint trong Python nâng cao
   </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">
     Tạo hoặc sao chép các trang trình bày từ các mẫu
    </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">
     Làm việc với các bảng PowerPoint qua API
    </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 dụng hoặc loại bỏ lớp bảo vệ trên các hình dạng
    </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">
     Thêm biểu đồ Excel dưới dạng OleObjects vào trang trình bày
    </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">
     Hỗ trợ cho các OleObject được liên kết
    </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">
     Tạo bản trình bày từ cơ sở dữ liệu
    </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">
     Bảo vệ bản trình bày & PDF kết quả
    </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">
     In bản trình bày trên máy in vật lý
    </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">
     Tạo và tùy chỉnh biểu đồ
    </p>
   </div>
   <div class="col-lg-12">
    <h2 class="h2title">
     yêu cầu hệ thống
    </h2>
    <ul>
	  <li>Tương thích với Python 3.5, 3.6, 3.7, 3.8 và 3.9</li>
	  <li>Trong trường hợp bạn viết mã Python trên Linux, hãy xem <a href="https://docs.aspose.com/slides/python-net/system-requirements/"> các yêu cầu bổ sung cho Linux </a></li>
    </ul>
   </div>
   <div class="col-lg-12">
    <h2 class="h2title">
     Cài đặt thế nào
    </h2>
    <p>Sử dụng <strong> pip </strong> để cài đặt thư viện Python của chúng tôi để xử lý Bản trình bày từ <a href="https://pypi.org/project/aspose.slides/"> kho lưu trữ PyPI </a></p>:
	<pre><code>pip install aspose.slides</code></pre>
   </div>
    <div class="col-lg-12">
        <h2 class="h2title">Tạo bản trình bày PowerPoint mới. Python PPTX, PPT hoặc ODP</h2>
        <p>Trong ví dụ dưới đây, chúng tôi đã thêm một dòng vào trang chiếu đầu tiên của bản trình bày.</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">Hợp nhất các bản trình bày: Python PPTX, PPT hoặc ODP</h2>
        <p>Mã Python này chỉ cho bạn cách hợp nhất các bản trình bày:</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"> Nhập bản trình bày từ PDF: Python PPTX, PPT hoặc ODP</h2>
        <p>Mã Python này trình bày quy trình chuyển đổi PDF sang 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">Chuyển đổi PowerPoint sang PDF với các tùy chọn mặc định: Python PPTX, PPT hoặc ODP sang PDF</h2>
        <p>Mã python này chỉ cho bạn cách chuyển đổi tài liệu PowerPoint PPT, PPTX và OpenOffice ODP thành tài liệu PDF bằng các tùy chọn mặc định. Tệp kết quả là tài liệu PDF ở mức chất lượng tối đa</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">Chuyển đổi PowerPoint sang JPG: Python PPTX, PPT hoặc ODP sang JPEG</h2>
        <p>Ví dụ sau đây cho bạn thấy cách chuyển đổi tài liệu PowerPoint PPT, PPTX và OpenOffice ODP thành một tập hợp các hình ảnh 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>

> Chúng tôi nhận thấy Aspose.Slides dễ sử dụng và hoạt động tốt trên các máy chủ của chúng tôi. Chúng tôi nhận thấy họ đáp ứng nhu cầu quan trọng về việc tạo tệp động để mở rộng phạm vi tiếp cận của chúng tôi ngoài ứng dụng web truyền thống.
>
> — Rick Joi | Workplace Dynamics, UK

> Sản phẩm hoạt động như được quảng cáo, tài liệu dễ theo dõi và các diễn đàn hỗ trợ là tất cả sự trợ giúp mà chúng tôi cần. Giải pháp cuối cùng mà chúng tôi triển khai đã vượt quá kỳ vọng ban đầu của chúng tôi rất nhiều.
>
> — Bruce Brien | Stratascope Inc, USA
