99偷拍视频精品区一区二,口述久久久久久久久久久久,国产精品夫妇激情啪发布,成人永久免费网站在线观看,国产精品高清免费在线,青青草在线观看视频观看,久久久久久国产一区,天天婷婷久久18禁,日韩动漫av在线播放直播

C#/VB.NET操作Word(一)——插入、修改、刪除Word批注

批注內容可以是對某段文字或內容的注釋,也可以是對文段中心思想的概括提要,或者是對文章內容的評判、疑問,以及在閱讀時給自己或他人起到提示作用。本篇文章中將介紹如何在C#/VB中操作Word批注,主要包含以下要點:

創新互聯公司于2013年創立,先為云夢等服務建站,云夢等地企業,進行企業商務咨詢服務。為云夢企業網站制作PC+手機+微官網三網同步一站式服務解決您的所有建站問題。

  • 插入Word批注
  • 修改Word批注
  • 刪除Word批注
    使用工具:Free Spire.Doc for .NET 6.3(最新社區版)
    :編輯代碼前注意添加引用Sprie.Doc.dll(dll文件可在安裝路徑下的Bin文件夾中獲取)

C# /VB.NET 操作Word (一)——插入、修改、刪除Word批注

1.插入Word批注

C#

using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;

namespace InsertComment_Word
{
    class Program
    {
        static void Main(string[] args)
        { 
            //實例化一個Document類對象,并加載Word文檔
            Document document = new Document();
            document.LoadFromFile("sample.docx");

            //獲取第一段第一節
            Section section = document.Sections[0];
            Paragraph paragraph = section.Paragraphs[0];

            //添加文本到批注
            string str = "This paragraph describes the origin and the purpose of WEF";
            Comment comment = paragraph.AppendComment(str);
            //添加批注作者
            comment.Format.Author = "E-iceblue";

            //保存并打開文檔
            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_Word

    Class Program

        Private Shared Sub Main(ByVal args() As String)
            Dim document As Document = New Document
            document.LoadFromFile("sample.docx")
            Dim section As Section = document.Sections(0)
            Dim paragraph As Paragraph = section.Paragraphs(0)
            Dim str As String = "This paragraph describes the origin and the purpose of WEF"
            Dim comment As Comment = paragraph.AppendComment(str)
            comment.Format.Author = "E-iceblue"
            document.SaveToFile("Comments.docx", FileFormat.Docx2010)
            System.Diagnostics.Process.Start("Comments.docx")
        End Sub
    End Class
End Namespace

測試結果:
C# /VB.NET 操作Word (一)——插入、修改、刪除Word批注

2.修改、刪除Word批注

測試文檔:
C# /VB.NET 操作Word (一)——插入、修改、刪除Word批注
C#

using Spire.Doc;

namespace ReplaceAndRemoveComment_Word
{
    class Program
    {
        static void Main(string[] args)
        {
            //初始化Document類實例,加載帶有批注的Word文檔
            Document document = new Document();
            document.LoadFromFile("test.docx");

            //修改第一個批注內容
            document.Comments[0].Body.Paragraphs[0].Replace("This paragraph describes the origin and the purpose of WEF", "What is the WEF ?", false, false);

            //移除第二個批注
            document.Comments.RemoveAt(1);

            //保存并打開文檔
            document.SaveToFile("RemoveAndReplace.docx", FileFormat.Docx);
            System.Diagnostics.Process.Start("RemoveAndReplace.docx");
        }
    }
}

VB.NET

Imports Spire.Doc

Namespace ReplaceAndRemoveComment_Word

    Class Program

        Private Shared Sub Main(ByVal args() As String)         
            Dim document As Document = New Document
            document.LoadFromFile("test.docx")
            document.Comments(0).Body.Paragraphs(0).Replace("This paragraph describes the origin and the purpose of WEF", "What is the WEF ?", false, false)
            document.Comments.RemoveAt(1)
            document.SaveToFile("RemoveAndReplace.docx", FileFormat.Docx)
            System.Diagnostics.Process.Start("RemoveAndReplace.docx")
        End Sub
    End Class
End Namespace

測試結果:
C# /VB.NET 操作Word (一)——插入、修改、刪除Word批注

以上是本次關于C#、VB.NET操作word批注的全部內容,感謝閱讀!
歡迎轉載,轉載請注明出處。

分享題目:C#/VB.NET操作Word(一)——插入、修改、刪除Word批注
當前地址:http://www.yijiale78.com/article46/jooseg.html

成都網站建設公司_創新互聯,為您提供App開發營銷型網站建設網站改版網站設計公司搜索引擎優化

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

手機網站建設