国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

在C#里面給PPT文檔添加注釋的實現代碼

2019-10-29 21:15:15
字體:
來源:轉載
供稿:網友

平常開會或者做總結報告的時候我們通常都會用到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");

效果圖:

PPT,添加注釋

全部代碼:

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文檔添加注釋的實現代碼,需要的朋友可以參考一下。

 

注:相關教程知識閱讀請移步到c#教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 岳普湖县| 驻马店市| 通山县| 依安县| 上思县| 高尔夫| 枣阳市| 乌苏市| 神池县| 睢宁县| 句容市| 新津县| 桑植县| 旌德县| 精河县| 碌曲县| 南充市| 瑞金市| 商都县| 邵阳市| 申扎县| 富锦市| 琼海市| 奇台县| 繁峙县| 吴桥县| 兴业县| 石屏县| 伊宁县| 都匀市| 岐山县| 广饶县| 湖州市| 来宾市| 大洼县| 兴城市| 泉州市| 招远市| 招远市| 双城市| 小金县|