时间:2025-07-10 10:53
人气:
作者:admin

Aspose.Slides for .NET这款 .NET SDK 允许您操作和转换 PowerPoint 文件,而无需安装任何第三方软件。此外,它易于设置,C# 开发人员可以立即上手。今天,让我们继续学习如何在 C# 中以编程方式将 PPT 转换为 SWF。
Aspose.Slides试用版免费下载,请联系Aspose中国区官方授权经销商慧都科技
加入Aspose技术交流QQ群(1041253375),与更多小伙伴一起探讨提升开发技能。
您可以通过 NuGet 包管理器安装它,也可以下载 SDK。
另一种方法是在程序包管理器控制台中运行以下命令:
Install-Package Aspose.Slides.NET
现在,我们将直接进入实现阶段。以下步骤展示了如何使用此 PowerPoint SDK 开发 PPT 到 SWF 的转换器。
您可以看到下面的代码片段,它以编程方式自动执行 PPT 到 SWF 的转换:
using Aspose.Slides;
using Aspose.Slides.Export;
namespace CSharp.Presentations.Conversion
{
class ODPToPPTX
{
static void Main()
{
// The path to the documents directory.
string dataDir = "files";
// Load the source PPTX/PPT file by initializing an instance of the Presentation class.
using (Presentation presentation = new Presentation(dataDir + "scattered_chart_out.pptx"))
{
// Create an object of the SwfOptions class.
SwfOptions swfOptions = new SwfOptions();
swfOptions.ViewerIncluded = false;
// Access the layout options for notes and comments.
INotesCommentsLayoutingOptions notesOptions = swfOptions.NotesCommentsLayouting;
// Set the position of notes in the SWF output to appear fully at the bottom of each slide.
notesOptions.NotesPosition = NotesPositions.BottomFull;
// Save presentation and notes pages by calling the Save method.
presentation.Save(dataDir + "SaveAsSwf_out.swf", SaveFormat.Swf, swfOptions);
}
}
}
}
输出:

本教程到此结束,希望对您有所帮助。这篇教程介绍了如何在 C# 中以编程方式将 PPT 转换为 SWF。如果您需要以编程方式将 PPTX/PPT 文件转换为其他常用文件格式,Aspose.Slides for .NET也是您的理想之选。我们将继续发布相关文章,以解决您的实际使用案例。
加入Aspose技术交流QQ群(1041253375),与更多小伙伴一起探讨提升开发技能。

Microsoft Agent Framework Skills 执行 Scripts(实
EF Core 原生 SQL 实战:FromSql、SqlQuery 与对