Xceed Words for .NET v5.2 Documentation
Xceed.Document.NET Assembly / Xceed.Document.NET Namespace / Document Class / AddComment(String,String,DateTime) Method
Specifies the Comment's textual content.
Specifies the name that corresponds to the Comment's author.
Specifies the date & time at which the Comment was created.
Example


In This Topic
    AddComment(String,String,DateTime) Method
    In This Topic
    Adds a new Comment in the Document.
    Syntax
    'Declaration
     
    
    Public Function AddComment( _
       ByVal commentText As String, _
       ByVal author As String, _
       ByVal date As Date _
    ) As Comment
    'Usage
     
    
    Dim instance As Document
    Dim commentText As String
    Dim author As String
    Dim date As Date
    Dim value As Comment
     
    value = instance.AddComment(commentText, author, date)

    Parameters

    commentText
    Specifies the Comment's textual content.
    author
    Specifies the name that corresponds to the Comment's author.
    date
    Specifies the date & time at which the Comment was created.

    Return Value

    The Comment that has been inserted in the Document.
    Example
    public static void AddCollaborativeReviewComments()
    {
      Console.WriteLine( "\tAddCollaborativeReviewComments()" );
    
      using( var document = DocX.Create( @"ProjectProposal.docx" ) )
      {
        // Participants:
        //  - Emma Roberts (Project Manager)
        //  - Daniel Lee (Senior Developer)
        //  - Sarah Thompson (UI/UX Designer)
        //  - Michael Chen (QA Lead)
        //  - Olivia Martin (Product Owner)
    
        // Title
        document.InsertParagraph( "Project Proposal – Collaborative Review" ).FontSize( 16 ).Bold().UnderlineStyle( UnderlineStyle.singleLine ).Alignment = Alignment.center;
    
        // Inserts Paragraph to attach Comments
        Paragraph intro = document.InsertParagraph( "This proposal outlines the architecture and delivery plan for the new Analytics Dashboard." );
    
        // Product Owner gives initial comment
        Comment mainComment = document.AddComment( commentText: "Great start! Please verify that all timeline estimates reflect the latest sprint capacity planning.",
                                                   author: "Olivia Martin",
                                                   date: new DateTime( 2025, 11, 1, 9, 15, 0 ) );
    
        intro.InsertComment( mainComment );
    
        // Project Manager replies
        Comment pmReply = document.AddComment(
          "Thanks Olivia. I will update the schedule section and adjust the dates accordingly.",
          "Emma Roberts",
          new DateTime( 2025, 11, 1, 10, 5, 0 ) );
        mainComment.AddReply( pmReply );
    
        // Developer joins the thread
        Comment devReply = document.AddComment(
          "While updating the schedule, please also add a note that backend API stabilization is expected to require an additional sprint.",
          "Daniel Lee",
          new DateTime( 2025, 11, 1, 11, 30, 0 ) );
        mainComment.AddReply( devReply );
    
        // Designer provides UI/UX perspective
        Comment uxReply = document.AddComment(
          "Agreed. Also note that the new dashboard wireframes will be ready this Friday, so the design review can be added to the schedule.",
          "Sarah Thompson",
          new DateTime( 2025, 11, 1, 13, 10, 0 ) );
        mainComment.AddReply( uxReply );
    
        // QA Lead adds risk considerations
        Comment qaReply = document.AddComment(
          "Please include a QA verification cycle after API stabilization. We’ve seen regressions during similar migrations.",
          "Michael Chen",
          new DateTime( 2025, 11, 1, 14, 40, 0 ) );
        mainComment.AddReply( qaReply );
    
    
        // Adds a second review thread on a technical paragraph
        Paragraph techSection = document.InsertParagraph( "\nThe system will rely on microservices communicating via an event-driven architecture." );
    
        Comment archComment = document.AddComment(
          "We should validate whether event replay support is required for auditability.",
          "Daniel Lee",
          new DateTime( 2025, 11, 2, 8, 45, 0 ) );
        techSection.InsertComment( archComment );
    
        // Product Owner replies
        var poReply = document.AddComment(
          "Yes, auditability is a core requirement—please confirm with the compliance team.",
          "Olivia Martin",
          new DateTime( 2025, 11, 2, 9, 20, 0 ) );
        archComment.AddReply( poReply );
    
        // Project Manager confirms next steps
        var pmConfirmReply = document.AddComment(
          "Noted. I will schedule a short meeting with Compliance to clarify the retention and logging policies.",
          "Emma Roberts",
          new DateTime( 2025, 11, 2, 10, 0, 0 ) );
        archComment.AddReply( pmConfirmReply );
    
    
        // Adds a third collaborative thread on UI/UX
        Paragraph uiSection = document.InsertParagraph( "\nThe dashboard interface will feature customizable widgets and responsive layout." );
    
        Comment uiRoot = document.AddComment(
          "I propose we add a note that accessibility compliance (WCAG 2.1 AA) will be a mandatory deliverable.",
          "Sarah Thompson",
          new DateTime( 2025, 11, 3, 11, 5, 0 ) );
        uiSection.InsertComment( uiRoot );
    
        // Developer responds
        uiRoot.AddReply( document.AddComment(
          "Good point. I'll review the library support for keyboard navigation and ARIA roles.",
          "Daniel Lee",
          new DateTime( 2025, 11, 3, 12, 10, 0 ) ) );
    
        // QA Lead confirms test coverage
        uiRoot.AddReply( document.AddComment(
          "We’ll include full accessibility tests in the automation pipeline.",
          "Michael Chen",
          new DateTime( 2025, 11, 3, 13, 45, 0 ) ) );
    
        // Saves output
        document.Save();
      }
    }
    Supported Frameworks

    .NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.

    .NET Framework: net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.

    See Also