agentleFS
aspose-wordsaspose-words/agentic-net-examples/comments/AGENTS.md

agentic-net-examples / comments

AGENTS.md4 starsChanged 3 months agoMITView on GitHub

Verified C# examples for comments scenarios in Aspose.Words for .NET

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this AGENTS.md into the rules it gives an agent

8 rules. 0 are common, 5 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use Aspose.Words.Comment class for comment APIs directly.

    line 17
  2. Very specific:

    Do not use invented Document.Comments or Aspose.Words.Comments APIs.

    line 19
  3. Very specific:

    Do not use undocumented save-option flags such as HtmlSaveOptions.ExportComments.

    line 20
  4. Distinctive:

    Prefer simple, verifiable workflows over speculative markup tricks.

    line 21
  5. Distinctive:

    Create realistic local sample inputs whenever the task mentions streams, files, folders, DOC/DOCX inputs, XML, JSON, or database-like …

    line 22
  6. Distinctive:

    Use the simplest workflow that satisfies the task.

    line 32
  7. Distinctive:

    When replacing a file, prefer the latest verified publish-ready version rather than a merely compiling draft.

    line 253
  8. Distinctive:

    Keep examples standalone, bootstrap missing inputs locally, and prefer documented Aspose APIs over speculative shortcuts.

    line 254

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md - Comments

Purpose

This folder is a live, curated example set for Comments scenarios. Treat every .cs file as a standalone console application. The goal is correct, warning-free examples that use documented Aspose APIs and match the original task intent.

Non-negotiable conventions

  • Use Aspose.Words.Comment class for comment APIs directly.
  • Enumerate comments with doc.GetChildNodes(NodeType.Comment, true).OfType<Comment>().
  • Do not use invented Document.Comments or Aspose.Words.Comments APIs.
  • Do not use undocumented save-option flags such as HtmlSaveOptions.ExportComments.
  • Prefer simple, verifiable workflows over speculative markup tricks.
  • Create realistic local sample inputs whenever the task mentions streams, files, folders, DOC/DOCX inputs, XML, JSON, or database-like sources.
  • Guard maybe-null values to avoid nullable-reference warnings such as CS8600, CS8602, and CS8604.

Recommended workflow selection

  • Native Comment Api workflow: 15 examples
  • Export Report workflow: 7 examples
  • Rendered Output workflow: 5 examples
  • Stream Batch IO workflow: 3 examples

Use the simplest workflow that satisfies the task.

Validation priorities

  1. The code must compile and run without manual input.
  2. API usage must be supported by the configured package versions.
  3. Exported outputs must actually be written by the example.
  4. Validation scenarios must inspect only the behavior requested by the task.
  5. Examples that depend on files, folders, streams, images, or data should bootstrap those inputs locally during the example run.

File-to-task reference

  • load-a-docx-file-enumerate-all-comments-and-print-each-author-and-text-to-console.cs
    • Task: Load a DOCX file, enumerate all comments, and print each author and text to console.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • add-a-new-comment-to-a-specific-paragraph-in-a-word-document-and-save-as-docx.cs
    • Task: Add a new comment to a specific paragraph in a Word document and save as DOCX.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • update-the-text-of-an-existing-comment-identified-by-its-index-while-preserving-original-f.cs
    • Task: Update the text of an existing comment identified by its index while preserving original formatting.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • delete-all-comments-authored-by-a-particular-user-from-the-loaded-document-before-exportin.cs
    • Task: Delete all comments authored by a particular user from the loaded document before exporting.
    • Workflow: export-report
    • Outputs: docx
    • Selected engine: mcp
  • set-custom-author-name-and-initials-for-programmatically-added-comments-in-a-document.cs
    • Task: Set custom author name and initials for programmatically added comments in a document.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • create-a-reply-to-an-existing-comment-and-ensure-the-reply-appears-nested-under-the-origin.cs
    • Task: Create a reply to an existing comment and ensure the reply appears nested under the original.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • iterate-through-the-comment-collection-and-remove-comments-older-than-a-specified-date-thr.cs
    • Task: Iterate through the comment collection and remove comments older than a specified date threshold.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • filter-comments-by-author-and-export-only-those-comments-to-a-separate-word-document-for-r.cs
    • Task: Filter comments by author and export only those comments to a separate Word document for review.
    • Workflow: export-report
    • Outputs: docx
    • Selected engine: mcp
  • export-all-comments-from-a-docx-file-to-a-csv-file-with-author-date-and-text-columns.cs
    • Task: Export all comments from a DOCX file to a CSV file with author, date, and text columns.
    • Workflow: export-report
    • Outputs: docx, csv
    • Selected engine: mcp
  • import-comments-from-an-exported-xml-file-and-attach-them-to-appropriate-locations-in-a-ne.cs
    • Task: Import comments from an exported XML file and attach them to appropriate locations in a new document.
    • Workflow: export-report
    • Outputs: docx, xml
    • Selected engine: mcp
  • extract-comment-metadata-author-date-and-text-and-write-it-to-a-json-file.cs
    • Task: Extract comment metadata-author, date, and text-and write it to a JSON file.
    • Workflow: export-report
    • Outputs: docx, json
    • Selected engine: llm
  • search-comments-containing-a-specific-keyword-and-highlight-the-corresponding-text-range-i.cs
    • Task: Search comments containing a specific keyword and highlight the corresponding text range in the document.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • load-multiple-word-documents-from-a-folder-aggregate-their-comments-and-generate-a-summary.cs
    • Task: Load multiple Word documents from a folder, aggregate their comments, and generate a summary report.
    • Workflow: export-report
    • Outputs: docx
    • Selected engine: mcp
  • generate-a-printable-report-listing-all-comments-with-page-numbers-and-associated-paragrap.cs
    • Task: Generate a printable report listing all comments with page numbers and associated paragraph text.
    • Workflow: export-report
    • Outputs: docx
    • Selected engine: mcp
  • apply-a-custom-style-to-all-comment-text-blocks-within-a-document-to-match-corporate-brand.cs
    • Task: Apply a custom style to all comment text blocks within a document to match corporate branding.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • preserve-comment-formatting-such-as-bold-and-italic-text-when-converting-a-document-to-htm.cs
    • Task: Preserve comment formatting such as bold and italic text when converting a document to HTML format.
    • Workflow: rendered-output
    • Outputs: docx, html
    • Selected engine: mcp
  • convert-a-doc-file-to-pdf-while-retaining-all-comment-annotations-visible-in-the-output.cs
    • Task: Convert a DOC file to PDF while retaining all comment annotations visible in the output.
    • Workflow: rendered-output
    • Outputs: docx, pdf, doc
    • Selected engine: mcp
  • convert-a-document-with-comments-to-xps-format-ensuring-comments-appear-as-markup-annotati.cs
    • Task: Convert a document with comments to XPS format, ensuring comments appear as markup annotations.
    • Workflow: rendered-output
    • Outputs: xps
    • Selected engine: mcp
  • add-a-comment-containing-a-hyperlink-to-an-external-resource-and-verify-the-link-functions.cs
    • Task: Add a comment containing a hyperlink to an external resource and verify the link functions in PDF.
    • Workflow: rendered-output
    • Outputs: pdf
    • Selected engine: mcp
  • validate-that-comment-reference-ids-update-correctly-after-inserting-new-paragraphs-into-t.cs
    • Task: Validate that comment reference IDs update correctly after inserting new paragraphs into the document.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • synchronize-comment-positions-after-document-sections-are-reordered-to-maintain-accurate-c.cs
    • Task: Synchronize comment positions after document sections are reordered to maintain accurate comment anchoring.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • use-comment-collection-events-to-trigger-custom-logging-whenever-a-comment-is-added-or-rem.cs
    • Task: Use comment collection events to trigger custom logging whenever a comment is added or removed.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • programmatically-accept-or-reject-comments-based-on-author-name-and-generate-a-revised-doc.cs
    • Task: Programmatically accept or reject comments based on author name and generate a revised document version.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • load-a-document-from-a-stream-add-comments-and-save-the-modified-document-back-to-a-memory.cs
    • Task: Load a document from a stream, add comments, and save the modified document back to a memory stream.
    • Workflow: stream-batch-io
    • Outputs: docx, doc
    • Selected engine: mcp
  • create-a-batch-process-that-adds-a-standardized-disclaimer-comment-to-every-document-in-a.cs
    • Task: Create a batch process that adds a standardized disclaimer comment to every document in a directory.
    • Workflow: stream-batch-io
    • Outputs: docx
    • Selected engine: mcp
  • load-a-document-change-comment-author-names-to-uppercase-and-save-the-updated-file.cs
    • Task: Load a document, change comment author names to uppercase, and save the updated file.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • extract-comment-text-and-embed-it-as-footnotes-within-the-same-document-for-alternative-pr.cs
    • Task: Extract comment text and embed it as footnotes within the same document for alternative presentation.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • implement-a-feature-that-hides-all-comments-in-the-document-view-without-removing-them-fro.cs
    • Task: Implement a feature that hides all comments in the document view without removing them from the file.
    • Workflow: rendered-output
    • Outputs: docx, pdf
    • Selected engine: mcp
  • compare-two-versions-of-a-document-and-list-comments-that-were-added-modified-or-deleted.cs
    • Task: Compare two versions of a document and list comments that were added, modified, or deleted.
    • Workflow: native-comment-api
    • Outputs: docx
    • Selected engine: mcp
  • create-a-utility-that-reads-comment-data-from-a-database-and-inserts-corresponding-comment.cs
    • Task: Create a utility that reads comment data from a database and inserts corresponding comments into a template document.
    • Workflow: stream-batch-io
    • Outputs: docx
    • Selected engine: mcp

Common failure patterns and preferred agent fixes

  • Wrong Node.Text usage
    • Symptom: error CS1061: 'Node' does not contain a definition for 'Text'
    • Preferred fix: Use Comment.GetText() for whole-comment content, or cast to a concrete node type such as Run before reading .Text.
  • Invented comment collection APIs
    • Symptom: Compile failures caused by Document.Comments or Aspose.Words.Comments usage.
    • Preferred fix: Enumerate comments with doc.GetChildNodes(NodeType.Comment, true).OfType<Comment>().
  • Unsupported comment-reference or save-option APIs
    • Symptom: Compile failures caused by CommentReference or undocumented save-option flags.
    • Preferred fix: Prefer simpler comment workflows and documented Aspose.Words save options only.
  • Unsafe live-collection mutation
    • Symptom: Unstable behavior while deleting comments during forward iteration over a live collection.
    • Preferred fix: Create a ToList copy first, then update or remove matching comments.
  • Nullable-reference warnings
    • Symptom: CS8600, CS8602, or CS8604 around maybe-null values such as CurrentParagraph or FirstOrDefault results.
    • Preferred fix: Use nullable locals where needed and guard maybe-null values before dereference or assignment.

Build and run contract

  • Target framework: net8.0
  • Package: Aspose.Words 26.9.0

Command reference

Create a temporary console project

dotnet new console -n ExampleProject --framework net8.0
cd ExampleProject

Add required packages

dotnet add package Aspose.Words --version 26.9.0

Copy a category example into the temp project

Copy-Item ..\comments\<example-file>.cs .\Program.cs

Build and run

dotnet build --configuration Release --verbosity minimal
dotnet run --configuration Release --no-build

Category update guidance

  • Preserve file-to-task traceability. Any future update should keep the original task text associated with the file in metadata.
  • When replacing a file, prefer the latest verified publish-ready version rather than a merely compiling draft.
  • Keep examples standalone, bootstrap missing inputs locally, and prefer documented Aspose APIs over speculative shortcuts.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.