In C # to add comments to the PPT document implementation code sharing

Source: Internet
Author: User
We usually use PowerPoint presentations when we have a meeting or a summary report, and we can add comments on a single slide or on all the slides so that the audience can get more information from the comments, and the friends you need can refer to

We usually use PowerPoint presentations when we have a meeting or a summary report, and we can add comments on a single slide or on all the slides so that the audience can get more information from the comments.

Some friends do not know how to add comments in the slide, let me share with you how to add comments to the slides in C #.

Here I use a free control--free spire.presentation, interested friends can download using.

Namespaces that need to be added:

Using spire.presentation;using system.drawing;

Detailed steps and code snippets are as follows:

Step 1: Create a new Presentation object and load the presentation file from inside the system.

Presentation Presentation = new Presentation ();p resentation. LoadFromFile ("Sample.pptx");

Step 2: Call the Commentauthorlist.addauthor (author name, string initials) method to add the author comment.

Icommentauthor author = presentation.CommentAuthors.AddAuthor ("E-iceblue", "Comment:");

Step 3: Invoke call presentation. Slides[]. AddComment () method to add annotations to a particular slide. The class of comments contains a lot of information, such as the author of the comment, the time when the comment was added, the location where the comment was added, and the content of the comment.

Presentation. SLIDES[1]. AddComment (author, "This is pretty important. Attention to it ", New System.Drawing.PointF (4), DateTime.Now);

Step 4: Save and reopen the presentation presentation.

Presentation. SaveToFile ("Pptwithcomment.pptx", fileformat.pptx2010); System.Diagnostics.Process.Start ("Pptwithcomment.pptx");

All code:

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 is pretty important.      Attention to it ", New System.Drawing.PointF (4), DateTime.Now); Save the document presentation.      SaveToFile ("Pptwithcomment.pptx", fileformat.pptx2010);    System.Diagnostics.Process.Start ("Pptwithcomment.pptx"); }  }}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.