
FileFormat.Slides for .NET
使用 .NET API 简化演示文稿的创建与定制
使用 FileFormat.Slides(开源 .NET API)轻松创建和定制演示文稿。使用此轻量级库简化幻灯片生成与自动化。
FileFormat.Slides for .NET 是什么?
FileFormat.Slides for .NET 提供了简单、易用且用户友好的体验,使其成为希望使用开源 API 处理 Microsoft PowerPoint 演示文稿的理想选择。这个开源的 .NET API 经过精心设计,简化了创建和自定义 PowerPoint 演示文稿的过程。借助这个直观的 C# 库,您现在只需几行代码即可轻松生成和操作演示文稿。
此轻量级解决方案的安装过程无缝且提供了一整套功能,以满足您所有的演示需求。FileFormat.Slides for .NET 利用 OpenXML SDK,这是一项受到 Microsoft 认可的技术。FileFormat.Slides for .NET 充当便利的包装器,简化了其高级功能的使用。
考虑到开发者,这个开源 .NET 库只需几行代码即可轻松实现 PowerPoint 演示文稿的创建和编辑。您可以使用 OpenXML SDK 库来增强其功能。得益于友好的设计,处理 FileFormat.Slides for .NET 非常简单。该库提供了智能功能,例如添加幻灯片、文本、以流方式打开现有演示文稿、对整个演示文稿或特定文本形状应用格式、向演示文稿添加图像等。
浏览我们的 GitHub 仓库以贡献代码、提出改进建议,并提升此开源 API: https://github.com/fileformat-slides/FileFormat.Slides-for-.NET
开始使用 FileFormat.Slides for .NET
推荐的安装 FileFormat.Slides for .NET 方法是使用 NuGet。请使用以下命令以顺利安装。
以编程方式创建 PowerPoint 演示文稿
FileFormat.Slides for .NET 为开发人员提供了一个灵活且强大的工具,用于自动化创建 PowerPoint 演示文稿和图表。软件开发人员可以从头创建新演示文稿,向其中添加幻灯片,插入图像,添加文本等。以下代码片段以编程方式创建一个空的 PowerPoint 演示文稿。
如何通过 .NET API 创建 PowerPoint 演示文稿?
// Create an object of the Presentation class.
Presentation presentation = Presentation.Create("presentation.pptx");
//Perform necessary operations.
//...
// Call the Save method to save the PowerPoint file onto the disk.
presentation.Save();
以编程方式向演示文稿插入文本
FileFormat.Slides for .NET 使软件开发人员能够轻松在 .NET 应用程序中向演示文稿幻灯片插入文本。该库的主要关注点是为开发人员提供以编程方式创建演示文稿并处理各种 PowerPoint 元素(如幻灯片、文本、图像、形状和图表)的能力。以下代码片段展示了开发人员如何以编程方式向演示文稿插入文本。
如何通过 .NET API 将文本插入到演示文稿中?
// Create a new PowerPoint presentation at the specified file path
Presentation presentation = Presentation.Create("D:\\AsposeSampleResults\\test2.pptx");
// Create a text shape for the title and set its properties
TextShape shape = new TextShape();
shape.Text = "Title: Here is my first title From FF";
shape.TextColor = "980078";
shape.FontFamily = "Baguet Script";
// Create the slide and add the text shape to it
Slide slide = new Slide();
slide.AddTextShapes(shape);
// Append the slide to the presentation
presentation.AppendSlide(slide);
// Save the modified presentation
presentation.Save();
