MudTools.OfficeInterop.PowerPoint
1.2.2
See the version list below for details.
dotnet add package MudTools.OfficeInterop.PowerPoint --version 1.2.2
NuGet\Install-Package MudTools.OfficeInterop.PowerPoint -Version 1.2.2
<PackageReference Include="MudTools.OfficeInterop.PowerPoint" Version="1.2.2" />
<PackageVersion Include="MudTools.OfficeInterop.PowerPoint" Version="1.2.2" />
<PackageReference Include="MudTools.OfficeInterop.PowerPoint" />
paket add MudTools.OfficeInterop.PowerPoint --version 1.2.2
#r "nuget: MudTools.OfficeInterop.PowerPoint, 1.2.2"
#:package MudTools.OfficeInterop.PowerPoint@1.2.2
#addin nuget:?package=MudTools.OfficeInterop.PowerPoint&version=1.2.2
#tool nuget:?package=MudTools.OfficeInterop.PowerPoint&version=1.2.2
MudTools.OfficeInterop.PowerPoint
PowerPoint 操作模块,提供完整的 PowerPoint 演示文稿操作接口。
项目概述
MudTools.OfficeInterop.PowerPoint 是专门用于操作 Microsoft PowerPoint 应用程序的 .NET 封装库。该模块提供了完整的 PowerPoint 演示文稿操作接口,包括幻灯片、母版、动画等对象的管理,以及演示文稿的创建、编辑和格式化功能。
通过使用本模块,开发者可以避免直接处理复杂的 PowerPoint COM 交互,从而更专注于业务逻辑的实现。
主要功能
- PowerPoint 演示文稿操作接口
- 幻灯片、母版、动画等对象的管理
- 演示文稿的创建、编辑和格式化功能
支持的框架
- .NET Framework 4.6.2
- .NET Framework 4.7
- .NET Framework 4.8
- .NET Standard 2.1
- .NET 6.0-windows
- .NET 7.0-windows
- .NET 8.0-windows
- .NET 9.0-windows
安装
<PackageReference Include="MudTools.OfficeInterop.PowerPoint" Version="1.1.8" />
核心组件
PowerPointFactory
PowerPointFactory 是用于创建和操作 PowerPoint 应用程序实例的工厂类,提供以下方法:
Connection- 通过现有 COM 对象连接到已运行的 PowerPoint 应用程序实例BlankWorkbook- 创建新的空白 PowerPoint 演示文稿Open- 打开现有的 PowerPoint 演示文稿文件
使用示例
创建演示文稿
// 创建 PowerPoint 应用程序实例
using var app = PowerPointFactory.CreateApplication();
app.Visible = true;
// 创建新演示文稿
var presentation = app.Presentations.Add();
// 添加幻灯片
var slide = presentation.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutTitle);
// 设置标题
slide.Shapes.Title.TextFrame.TextRange.Text = "欢迎使用 PowerPoint";
// 添加内容
slide.Shapes.Placeholders[2].TextFrame.TextRange.Text = "这是演示文稿的内容部分";
// 保存演示文稿
presentation.SaveAs(@"C:\presentations\example.pptx");
操作现有演示文稿
// 打开现有演示文稿
using var app = PowerPointFactory.Open(@"C:\presentations\ExistingPresentation.pptx");
var presentation = app.ActivePresentation;
// 遍历所有幻灯片
foreach (var slide in presentation.Slides)
{
Console.WriteLine($"幻灯片 {slide.SlideIndex}: {slide.Name}");
// 修改幻灯片内容
if (slide.Shapes.HasTitle == MsoTriState.msoTrue)
{
slide.Shapes.Title.TextFrame.TextRange.Text += " - 已更新";
}
}
// 添加新幻灯片
var newSlide = presentation.Slides.Add(presentation.Slides.Count + 1,
PowerPoint.PpSlideLayout.ppLayoutText);
newSlide.Shapes.Title.TextFrame.TextRange.Text = "新幻灯片";
newSlide.Shapes.Placeholders[2].TextFrame.TextRange.Text = "这是新增的幻灯片内容";
presentation.Save();
app.Quit();
PowerPoint 格式化和动画
using var app = PowerPointFactory.BlankWorkbook();
var presentation = app.ActivePresentation;
// 添加幻灯片
var slide = presentation.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutBlank);
// 添加形状
var shape = slide.Shapes.AddShape(MsoAutoShapeType.msoShapeRectangle, 100, 100, 200, 100);
shape.TextFrame.TextRange.Text = "示例形状";
// 设置形状格式
shape.Fill.ForeColor.RGB = 0x00FF00; // 绿色填充
shape.Line.ForeColor.RGB = 0xFF0000; // 红色边框
// 添加动画
var animation = shape.AnimationSettings;
animation.EntryEffect = PowerPoint.PpEntryEffect.ppEffectFade;
animation.AdvanceMode = PowerPoint.PpAdvanceMode.ppAdvanceOnClick;
presentation.SaveAs(@"C:\presentations\AnimatedPresentation.pptx");
app.Quit();
许可证
本项目采用双重许可证模式:
免责声明
本项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- log4net (>= 3.2.0)
- MudTools.OfficeInterop (>= 1.2.2)
- System.ValueTuple (>= 4.6.1)
-
.NETStandard 2.0
- log4net (>= 3.2.0)
- MudTools.OfficeInterop (>= 1.2.2)
- System.Drawing.Common (>= 4.7.3)
- System.ValueTuple (>= 4.6.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 2.0.9 | 204 | 4/24/2026 | |
| 2.0.8 | 901 | 2/24/2026 | |
| 2.0.7 | 113 | 2/4/2026 | |
| 2.0.6 | 115 | 1/24/2026 | |
| 2.0.5 | 129 | 1/11/2026 | |
| 2.0.4 | 127 | 1/6/2026 | |
| 2.0.3 | 123 | 12/31/2025 | |
| 2.0.2 | 114 | 12/27/2025 | |
| 2.0.1 | 228 | 12/25/2025 | |
| 1.2.2 | 169 | 11/1/2025 | |
| 1.2.1 | 230 | 10/23/2025 | |
| 1.2.0 | 216 | 10/20/2025 | |
| 1.1.9 | 228 | 10/1/2025 | |
| 1.1.8 | 225 | 9/25/2025 | |
| 1.1.7 | 267 | 9/22/2025 | |
| 1.1.6 | 401 | 9/19/2025 | |
| 1.1.5 | 432 | 9/17/2025 | |
| 1.1.4 | 272 | 9/14/2025 | |
| 1.1.3 | 241 | 9/12/2025 | |
| 1.1.2 | 432 | 9/11/2025 |
Initial release of MudTools.OfficeInterop.PowerPoint library.