PowerPoint文档的属性通常包括标题、主题、标记、作者、公司等信息。恰当的文档属性可以帮助读者快速了解文档所要传递的信息。本文将介绍如何使用Spire.Presenation为PowerPoint文档设置文档属性以及获取现有PowerPoint文档的属性。
设置文档属性
C#
//创建PPT文档
Presentation ppt = new Presentation();
//设置文档属性
ppt.DocumentProperty.Title = "怎样使用Spire.Presentation设置文档属性";
ppt.DocumentProperty.Subject = "无";
ppt.DocumentProperty.Author = "Spire.Presentation";
ppt.DocumentProperty.Manager = "Bill";
ppt.DocumentProperty.Company = "成都冰蓝科技有限公司";
ppt.DocumentProperty.Category = "示例文档";
ppt.DocumentProperty.Keywords = "PowerPoint文档属性";
ppt.DocumentProperty.Comments = "更多详情,请访问https://www.e-iceblue.com/";
//保存文档
ppt.SaveToFile("设置文档属性.pptx", FileFormat.Pptx2013);
VB.NET
'创建PPT文档
Dim ppt As New Presentation()
'设置文档属性
ppt.DocumentProperty.Title = "怎样使用Spire.Presentation设置文档属性"
ppt.DocumentProperty.Subject = "无"
ppt.DocumentProperty.Author = "Spire.Presentation"
ppt.DocumentProperty.Manager = "Bill"
ppt.DocumentProperty.Company = "成都冰蓝科技有限公司"
ppt.DocumentProperty.Category = "示例文档"
ppt.DocumentProperty.Keywords = "PowerPoint文档属性"
ppt.DocumentProperty.Comments = "更多详情,请访问https://www.e-iceblue.com/"
'保存文档
ppt.SaveToFile("设置文档属性.pptx", FileFormat.Pptx2013)
获取文档属性
C#
//加载现有PPT文档
Presentation ppt = new Presentation();
ppt.LoadFromFile("设置文档属性.pptx");
//获取文档属性
Console.WriteLine("标题: " + ppt.DocumentProperty.Title);
Console.WriteLine("主题: " + ppt.DocumentProperty.Subject);
Console.WriteLine("作者: " + ppt.DocumentProperty.Author);
Console.WriteLine("管理者: " + ppt.DocumentProperty.Manager);
Console.WriteLine("公司: " + ppt.DocumentProperty.Company);
Console.WriteLine("类别: " + ppt.DocumentProperty.Category);
Console.WriteLine("标记: " + ppt.DocumentProperty.Keywords);
Console.WriteLine("备注: " + ppt.DocumentProperty.Comments);
Console.ReadKey();
VB.NET
'加载现有PPT文档
Dim ppt As New Presentation()
ppt.LoadFromFile("设置文档属性.pptx")
'获取文档属性
Console.WriteLine("标题: " + ppt.DocumentProperty.Title)
Console.WriteLine("主题: " + ppt.DocumentProperty.Subject)
Console.WriteLine("作者: " + ppt.DocumentProperty.Author)
Console.WriteLine("管理者: " + ppt.DocumentProperty.Manager)
Console.WriteLine("公司: " + ppt.DocumentProperty.Company)
Console.WriteLine("类别: " + ppt.DocumentProperty.Category)
Console.WriteLine("标记: " + ppt.DocumentProperty.Keywords)
Console.WriteLine("备注: " + ppt.DocumentProperty.Comments)
Console.ReadKey()