在C#里面給PPT文檔添加注釋的實現(xiàn)代碼
平常開會或者做總結(jié)報告的時候我們通常都會用到PowerPoint演示文稿,我們可以在單個幻燈片或者全部幻燈片里面添加注釋,這樣觀眾可以從注釋內(nèi)容里面獲取更多的相關(guān)信息。
有些朋友不清楚如何在幻燈片里面添加注釋,下面我跟大家分享一下如何在C#里面為幻燈片添加注釋。
在這里我使用了一個免費控件——Free Spire.Presentation,有興趣的朋友可以下載使用。
需要添加的命名空間:
using Spire.Presentation; using System.Drawing;
詳細步驟和代碼片段如下:
步驟1:新建一個Presentation對象,從系統(tǒng)里面加載Presentation文件。
Presentation presentation = new Presentation(); presentation.LoadFromFile("sample.pptx");
步驟2:調(diào)用CommentAuthorList.AddAuthor(author name, string initials) 方法來添加作者注釋。
ICommentAuthor author = presentation.CommentAuthors.AddAuthor("E-iceblue", "comment:");
步驟3:調(diào)用Call presentation.Slides[].AddComment() 方法來給某一張?zhí)囟ɑ脽羝砑幼⒔?。注釋的類包含很多信息,像添加注釋的作者、添加注釋的時間、添加注釋的位置和注釋的內(nèi)容。
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文檔添加注釋的實現(xiàn)代碼,需要的朋友可以參考一下。
上一篇:httpwebreqeust讀取httponly的cookie方法
欄 目:C#教程
下一篇:C#遍歷文件夾及子目錄下所有圖片
本文標題:在C#里面給PPT文檔添加注釋的實現(xiàn)代碼
本文地址:http://mengdiqiu.com.cn/a1/C_jiaocheng/5979.html
您可能感興趣的文章
- 01-10C#實現(xiàn)將窗體固定在顯示器的左上角且不能移動的方法
- 01-10C#實現(xiàn)在Form里面內(nèi)嵌dos窗體的方法
- 01-10C#中查找Dictionary中的重復(fù)值的方法
- 01-10C#實現(xiàn)在啟動目錄創(chuàng)建快捷方式的方法
- 01-10C#獲取動態(tài)生成的CheckBox值
- 01-10關(guān)于nancy中的身份驗證
- 01-10C#編程自學之類和對象
- 01-10C#創(chuàng)建不規(guī)則窗體的4種方式詳解
- 01-10C#實現(xiàn)讀取DataSet數(shù)據(jù)并顯示在ListView控件中的方法
- 01-10C#中yield用法使用說明


閱讀排行
本欄相關(guān)
- 01-10C#通過反射獲取當前工程中所有窗體并
- 01-10關(guān)于ASP網(wǎng)頁無法打開的解決方案
- 01-10WinForm限制窗體不能移到屏幕外的方法
- 01-10WinForm繪制圓角的方法
- 01-10C#實現(xiàn)txt定位指定行完整實例
- 01-10WinForm實現(xiàn)仿視頻播放器左下角滾動新
- 01-10C#停止線程的方法
- 01-10C#實現(xiàn)清空回收站的方法
- 01-10C#通過重寫Panel改變邊框顏色與寬度的
- 01-10C#實現(xiàn)讀取注冊表監(jiān)控當前操作系統(tǒng)已
隨機閱讀
- 01-10C#中split用法實例總結(jié)
- 01-11ajax實現(xiàn)頁面的局部加載
- 04-02jquery與jsp,用jquery
- 01-10delphi制作wav文件的方法
- 01-10使用C語言求解撲克牌的順子及n個骰子
- 08-05dedecms(織夢)副欄目數(shù)量限制代碼修改
- 01-11Mac OSX 打開原生自帶讀寫NTFS功能(圖文
- 08-05DEDE織夢data目錄下的sessions文件夾有什
- 01-10SublimeText編譯C開發(fā)環(huán)境設(shè)置
- 08-05織夢dedecms什么時候用欄目交叉功能?