寻常开会或许做总结报告的时刻我们一般都邑用到PowerPoint演示文稿,我们能够在单个幻灯片或许悉数幻灯片内里增加解释,如许观众能够从解释内容内里猎取更多的相干信息。
有些朋侪不清楚如安在幻灯片内里增加解释,下面我跟人人分享一下如安在C#内里为幻灯片增加解释。
在这里我运用了一个免费控件——Free Spire.Presentation,有兴致的朋侪能够下载运用。
须要增加的定名空间:
using Spire.Presentation; using System.Drawing;
细致步骤和代码片断以下:
步骤1:新建一个Presentation对象,从体系内里加载Presentation文件。
Presentation presentation = new Presentation(); presentation.LoadFromFile("sample.pptx");
步骤2:挪用CommentAuthorList.AddAuthor(author name, string initials) 要领来增加作者解释。
ICommentAuthor author = presentation.CommentAuthors.AddAuthor("E-iceblue", "comment:");
步骤3:挪用Call presentation.Slides[].AddComment() 要领来给某一张特定幻灯片增加注解。解释的类包括许多信息,像增加解释的作者、增加解释的时候、增加解释的位置和解释的内容。
presentation.Slides[1].AddComment(author, "This part is pretty important. Please pay attention to it", new System.Drawing.PointF(42, 4), DateTime.Now);
步骤4:保留并从新翻开Presentation演示文稿。
presentation.SaveToFile("PPTwithcomment.pptx", FileFormat.Pptx2010); System.Diagnostics.Process.Start("PPTwithcomment.pptx");
效果图:
悉数代码:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Spire.Presentation; namespace PPTComment { class Program { static void Main(string[] args) { //create PPT document and load file Presentation presentation = new Presentation(); presentation.LoadFromFile("sample.pptx"); //comment author ICommentAuthor author = presentation.CommentAuthors.AddAuthor("E-iceblue", "comment:"); //add comment presentation.Slides[1].AddComment(author, "This part is pretty important. Please pay attention to it", new System.Drawing.PointF(42, 4), DateTime.Now); //save the document presentation.SaveToFile("PPTwithcomment.pptx", FileFormat.Pptx2010); System.Diagnostics.Process.Start("PPTwithcomment.pptx"); } } }
以上就是在C#内里给PPT文档完成增加解释的代码分享的细致内容,更多请关注ki4网别的相干文章!