C# 添加PPT 注释

在生活和工作中,PPT是一种比较常用的用于演示的文档。它能以多变、简洁、丰富的图文形式向阅读者传递信息。对于一些幻灯片中的内容,我们需要作出说明和解释时,可以通过使用添加注释的形式。那在C#中,我们应该如何来操作呢。在本文中将介绍一种比较简单的实现方法。(文章转自http://www.cnblogs.com/Yesi/p/5429995.html

使用工具:Free Spire.Presentation(社区版)

PS:安装后,注意添加dll到你的程序

C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spire.Presentation;

namespace PPTComment
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建一个Presentation类对象,并加载PPT文档
            Presentation presentation = new Presentation();
            presentation.LoadFromFile("sample.pptx");

            //添加作者信息
            ICommentAuthor author = presentation.CommentAuthors.AddAuthor("E-iceblue", "comment:");
            //添加注释
            presentation.Slides[1].AddComment(author, "This part is pretty important. Please pay attention to it", new System.Drawing.PointF(42, 4), DateTime.Now);

            //保存文档并运行生成的文档
            presentation.SaveToFile("PPTwithcomment.pptx", FileFormat.Pptx2010);
            System.Diagnostics.Process.Start("PPTwithcomment.pptx");
        }
    }
}

 运行结果:



 

猜你喜欢

转载自miaonly.iteye.com/blog/2412175
今日推荐