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


閱讀排行
- 1C語(yǔ)言 while語(yǔ)句的用法詳解
- 2java 實(shí)現(xiàn)簡(jiǎn)單圣誕樹(shù)的示例代碼(圣誕
- 3利用C語(yǔ)言實(shí)現(xiàn)“百馬百擔(dān)”問(wèn)題方法
- 4C語(yǔ)言中計(jì)算正弦的相關(guān)函數(shù)總結(jié)
- 5c語(yǔ)言計(jì)算三角形面積代碼
- 6什么是 WSH(腳本宿主)的詳細(xì)解釋
- 7C++ 中隨機(jī)函數(shù)random函數(shù)的使用方法
- 8正則表達(dá)式匹配各種特殊字符
- 9C語(yǔ)言十進(jìn)制轉(zhuǎn)二進(jìn)制代碼實(shí)例
- 10C語(yǔ)言查找數(shù)組里數(shù)字重復(fù)次數(shù)的方法
本欄相關(guān)
- 01-10C#通過(guò)反射獲取當(dāng)前工程中所有窗體并
- 01-10關(guān)于ASP網(wǎng)頁(yè)無(wú)法打開(kāi)的解決方案
- 01-10WinForm限制窗體不能移到屏幕外的方法
- 01-10WinForm繪制圓角的方法
- 01-10C#實(shí)現(xiàn)txt定位指定行完整實(shí)例
- 01-10WinForm實(shí)現(xiàn)仿視頻 器左下角滾動(dòng)新
- 01-10C#停止線程的方法
- 01-10C#實(shí)現(xiàn)清空回收站的方法
- 01-10C#通過(guò)重寫(xiě)Panel改變邊框顏色與寬度的
- 01-10C#實(shí)現(xiàn)讀取注冊(cè)表監(jiān)控當(dāng)前操作系統(tǒng)已
隨機(jī)閱讀
- 01-10C#中split用法實(shí)例總結(jié)
- 01-11ajax實(shí)現(xiàn)頁(yè)面的局部加載
- 04-02jquery與jsp,用jquery
- 01-10delphi制作wav文件的方法
- 01-10使用C語(yǔ)言求解撲克牌的順子及n個(gè)骰子
- 08-05dedecms(織夢(mèng))副欄目數(shù)量限制代碼修改
- 01-11Mac OSX 打開(kāi)原生自帶讀寫(xiě)NTFS功能(圖文
- 08-05DEDE織夢(mèng)data目錄下的sessions文件夾有什
- 01-10SublimeText編譯C開(kāi)發(fā)環(huán)境設(shè)置
- 08-05織夢(mèng)dedecms什么時(shí)候用欄目交叉功能?