Word控件Spire.Doc 【评论】教程(1):在 C#、VB.NET 中插入 Word 注释

Spire.Doc for .NET是一款专门对 Word 文档进行操作的 .NET 类库。在于帮助开发人员无需安装 Microsoft Word情况下,轻松快捷高效地创建、编辑、转换和打印 Microsoft Word 文档。拥有近10年专业开发经验Spire系列办公文档开发工具,专注于创建、编辑、转换和打印Word/PDF/Excel等格式文件处理,小巧便捷。

Spire.Doc for.NET 最新下载(qun:767755948)icon-default.png?t=M85Bhttps://www.evget.com/product/3368/download

文字注释,由用户插入以显示对单词、短语或段落的意见或附加信息,经常出现在文档页边空白处。读者可以根据评论了解更多关于内容的信息或修改内容以更正确或更清楚地表达自己

Spire.Doc for .NET是一个专业的.NET Word 组件,用于操作Word 文档,使用户能够使用C#、VB.NET 在Word 中插入注释。用户可以直接调用 paragraph.AppendComment(string) 方法为指定段落插入注释。此外,Spire.Doc for .NET 还为用户提供了 Comment 类。用户可以使用此类提供的 Format 属性来设置格式注释。

下面演示了评论可以有多完美。您也可以免费下载 Spire.Doc并进行试用。

[C#]

using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;
namespace InsertComment
{
class Program
{

static void Main(string[] args)
{

//Load Document
Document document = new Document();
document.LoadFromFile(@"E:\work\Documents\WordDocuments\Humor Them.docx");

//Get Paragraph to Insert Comment
Section section = document.Sections[0];
Paragraph paragraph = section.Paragraphs[2];

//Insert Comment
string str = "This paragraph presents the first example to Humor Them.";
Comment comment = paragraph.AppendComment(str);
comment.Format.Author = "E-iceblue";
comment.Format.Initial = "CM";

//Save Document
document.SaveToFile("comments.docx", FileFormat.Docx2010);
System.Diagnostics.Process.Start("comments.docx");
}
}
}

[VB.NET]

Imports Spire.Doc
Imports Spire.Doc.Documents
Imports Spire.Doc.Fields
Namespace InsertComment
Class Program

Private Shared Sub Main(args As String())

'Load Document
Dim document As New Document()
document.LoadFromFile("E:\work\Documents\WordDocuments\Humor Them.docx")

'Get Paragraph to Insert Comment
Dim section As Section = document.Sections(0)
Dim paragraph As Paragraph = section.Paragraphs(2)

'Insert Comment
Dim str As String = "This paragraph presents the first example to Humor Them."
Dim comment As Comment = paragraph.AppendComment(str)
comment.Format.Author = "E-iceblue"
comment.Format.Initial = "CM"

'Save Document
document.SaveToFile("comments.docx", FileFormat.Docx2010)
System.Diagnostics.Process.Start("comments.docx")
End Sub
End Class
End Namespace

Spire.Doc 是一个 Microsoft Word 组件,它使用户能够直接执行范围广泛的 Word 文档处理任务,例如在 WPF、.NET 和 Silverlight 中生成、读取、写入和修改 Word 文档。

以上便是在 C#、VB.NET 中插入 Word 注释,如果您有其他问题也可以继续浏览本系列文章,获取相关教程,你还可以给我留言或者加入我们的官方技术交流群。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值