欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

在C#里面給PPT文檔添加注釋的實現(xiàn)代碼

 更新時間:2017年01月24日 22:35:55   投稿:mdxy-dxy  
平常開會或者做總結(jié)報告的時候我們通常都會用到PowerPoint演示文稿,我們可以在單個幻燈片或者全部幻燈片里面添加注釋,這樣觀眾可以從注釋內(nèi)容里面獲取更多的相關信息,需要的朋友可以參考下

平常開會或者做總結(jié)報告的時候我們通常都會用到PowerPoint演示文稿,我們可以在單個幻燈片或者全部幻燈片里面添加注釋,這樣觀眾可以從注釋內(nèi)容里面獲取更多的相關信息。

有些朋友不清楚如何在幻燈片里面添加注釋,下面我跟大家分享一下如何在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í)囟ɑ脽羝砑幼⒔狻W⑨尩念惏芏嘈畔?,像添加注釋的作者、添加注釋的時間、添加注釋的位置和注釋的內(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)代碼,需要的朋友可以參考一下。

相關文章

最新評論