Aspose.Slides for .NET
Contents
[
Hide
]
Aspose.Slides for .NET 是一個類別庫,用於在 .NET 應用程式中建立、讀取、編輯和轉換 PowerPoint 以及 OpenDocument 簡報,無需 Microsoft PowerPoint 或 Office Automation。
它能載入與儲存 PPT、PPTX、PPS、POT 與 ODP,包含啟用巨集與範本的變體,並可匯出為 PDF、XPS、HTML、SVG、TIFF、Markdown 與影像。
使用 Slides 建置
常見任務
Slides 工作流程
範例
您的第一個簡報
使用 .NET SDK 6 或更新版本建立一個主控台應用程式:
dotnet new console -n HelloSlides
cd HelloSlides
然後為您的平台新增一個套件:
- On Windows:
dotnet add package Aspose.Slides.NET - On Linux and macOS:
dotnet add package Aspose.Slides.NET6.CrossPlatform— see 安裝 for the Linux prerequisite and for the systems that need Aspose.Slides.NET instead.
將 Program.cs 的內容取代為以下程式碼,然後執行 dotnet run:
using Aspose.Slides;
using Aspose.Slides.Export;
using var presentation = new Presentation();
var slide = presentation.Slides[0];
var shape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 50, 50, 400, 100);
shape.TextFrame.Text = "Hello, Aspose.Slides!";
presentation.Save("hello.pptx", SaveFormat.Pptx);
此程式會將 hello.pptx 儲存為含有一張投影片與文字方塊的檔案。若未取得授權,儲存的檔案會帶有評估浮水印 — see 授權. 若想了解更多建立與填充簡報的方法,請參閱 建立簡報.