agentic-net-examples / comparison
AGENTS.md4 starsChanged 3 months agoMITView on GitHub
Verified C# examples for comparison scenarios in Aspose.Words for .NET
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository29 other files it gives its agents.
- aspose-words-examplesAGENTS.md
- barcode-imageAGENTS.md
- chartsAGENTS.md
- commentsAGENTS.md
- content-controlAGENTS.md
- conversionAGENTS.md
- extractionAGENTS.md
- find-and-replaceAGENTS.md
- fontsAGENTS.md
- form-fieldsAGENTS.md
- hyphenationAGENTS.md
- imagesAGENTS.md
- join-documentsAGENTS.md
- linq-reportingAGENTS.md
- listsAGENTS.md
- mail-mergeAGENTS.md
- officemathAGENTS.md
- ole-objectsAGENTS.md
- paragraphsAGENTS.md
- programming-with-documentsAGENTS.md
- rangeAGENTS.md
- renderingAGENTS.md
- security-and-protectionAGENTS.md
- shapesAGENTS.md
- split-documentAGENTS.md
- track-changesAGENTS.md
- vba-macrosAGENTS.md
- watermarkAGENTS.md
- working-with-tableAGENTS.md
The file
We split this AGENTS.md into the rules it gives an agent
6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Use Document.Compare and inspect actual document.Revisions items.
- Distinctive: line 18
Create meaningful local source document differences before comparison.
- Very specific: line 19
Use supported CompareOptions members only when the task explicitly requires them.
- Distinctive: line 29
Use the simplest workflow that satisfies the task.
- Distinctive: line 250
When replacing a file, prefer the latest verified publish-ready version rather than a merely compiling draft.
- Distinctive: line 251
Keep examples standalone, bootstrap missing inputs locally, and prefer documented Aspose APIs over speculative shortcuts.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md - Comparison
Purpose
This folder is a live, curated example set for Comparison 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
Document.Compareand inspect actualdocument.Revisionsitems. - Create meaningful local source document differences before comparison.
- Use supported
CompareOptionsmembers only when the task explicitly requires them. - Bootstrap local files, folders, and MemoryStream-backed documents whenever external-style inputs are needed.
- Guard maybe-null values to avoid nullable-reference warnings such as
CS8600,CS8602, andCS8604.
Recommended workflow selection
- Revision Processing workflow: 19 examples
- Stream Batch IO workflow: 2 examples
- Native Comparison Api workflow: 9 examples
Use the simplest workflow that satisfies the task.
Validation priorities
- The code must compile and run without manual input.
- API usage must be supported by the configured package versions.
- Exported outputs must actually be written by the example.
- Validation scenarios must inspect only the behavior requested by the task.
- Examples that depend on files, folders, streams, images, or data should bootstrap those inputs locally during the example run.
File-to-task reference
load-two-docx-files-compare-them-and-save-the-resulting-document-with-revisions-applied.cs- Task: Load two DOCX files, compare them, and save the resulting document with revisions applied.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
load-a-doc-file-compare-it-with-another-doc-and-save-the-result-with-revisions-included.cs- Task: Load a DOC file, compare it with another DOC, and save the result with revisions included.
- Workflow: revision-processing
- Outputs: doc
- Selected engine: mcp
use-a-memorystream-to-load-documents-perform-comparison-and-write-the-result-to-a-byte-arr.cs- Task: Use a MemoryStream to load documents, perform comparison, and write the result to a byte array.
- Workflow: stream-batch-io
- Outputs: docx
- Selected engine: mcp
batch-process-a-folder-of-document-pairs-generating-compared-versions-with-revision-tracki.cs- Task: Batch process a folder of document pairs, generating compared versions with revision tracking for each pair.
- Workflow: stream-batch-io
- Outputs: docx
- Selected engine: mcp
apply-custom-author-name-and-timestamp-when-calling-compare-to-attribute-revisions-to-a-sp.cs- Task: Apply custom author name and timestamp when calling Compare to attribute revisions to a specific user.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
configure-comparisonoptions-to-ignore-formatting-changes-before-performing-document-compar.cs- Task: Configure ComparisonOptions to ignore formatting changes before performing document comparison on large legal contracts.
- Workflow: native-comparison-api
- Outputs: docx
- Selected engine: mcp
configure-comparisonoptions-to-ignore-case-differences-when-comparing-textual-content-acro.cs- Task: Configure ComparisonOptions to ignore case differences when comparing textual content across documents.
- Workflow: native-comparison-api
- Outputs: docx
- Selected engine: mcp
configure-comparisonoptions-to-ignore-whitespace-changes-when-comparing-source-code-docume.cs- Task: Configure ComparisonOptions to ignore whitespace changes when comparing source code documentation files.
- Workflow: native-comparison-api
- Outputs: docx
- Selected engine: llm
enable-detection-of-moved-paragraphs-by-setting-appropriate-flags-in-comparisonoptions-bef.cs- Task: Enable detection of moved paragraphs by setting appropriate flags in ComparisonOptions before comparison.
- Workflow: native-comparison-api
- Outputs: docx
- Selected engine: mcp
set-comparisontarget-to-new-document-so-that-revisions-appear-in-the-second-file.cs- Task: Set ComparisonTarget to new document so that revisions appear in the second file.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
set-comparisonoptions-showdeletedcontent-to-true-to-retain-deleted-text-in-the-comparison.cs- Task: Set ComparisonOptions.ShowDeletedContent to true to retain deleted text in the comparison output.
- Workflow: native-comparison-api
- Outputs: docx
- Selected engine: mcp
use-comparisonoptions-to-limit-comparison-to-specific-sections-of-the-document-for-targete.cs- Task: Use ComparisonOptions to limit comparison to specific sections of the document for targeted analysis.
- Workflow: native-comparison-api
- Outputs: docx
- Selected engine: mcp
compare-a-doc-file-with-a-docx-file-and-verify-that-table-structure-differences-are-detect.cs- Task: Compare a DOC file with a DOCX file and verify that table structure differences are detected.
- Workflow: native-comparison-api
- Outputs: docx, doc
- Selected engine: mcp
compare-documents-with-different-page-orientations-and-verify-that-orientation-changes-app.cs- Task: Compare documents with different page orientations and verify that orientation changes appear as revisions.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
compare-documents-containing-embedded-charts-and-ensure-that-chart-data-changes-are-captur.cs- Task: Compare documents containing embedded charts and ensure that chart data changes are captured as revisions.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: existing_repo
compare-a-document-against-itself-to-confirm-that-no-revisions-are-generated.cs- Task: Compare a document against itself to confirm that no revisions are generated.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
iterate-through-doc1-revisions-collection-and-log-each-revision-type-and-affected-text.cs- Task: Iterate through doc1.Revisions collection and log each revision type and affected text.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
detect-changes-in-table-cell-formatting-and-log-the-specific-cell-coordinates-for-each-rev.cs- Task: Detect changes in table cell formatting and log the specific cell coordinates for each revision.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
create-a-custom-logger-that-records-revision-type-author-and-timestamp-for-each-detected-c.cs- Task: Create a custom logger that records revision type, author, and timestamp for each detected change.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
check-doc1-revisions-count-equals-zero-to-determine-that-two-documents-are-identical-after.cs- Task: Check doc1.Revisions.Count equals zero to determine that two documents are identical after comparison.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
accept-only-formatting-revisions-while-rejecting-all-content-changes-in-the-compared-docum.cs- Task: Accept only formatting revisions while rejecting all content changes in the compared document.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
reject-revisions-related-to-header-modifications-and-preserve-footer-changes-in-the-final.cs- Task: Reject revisions related to header modifications and preserve footer changes in the final output.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
after-comparison-programmatically-accept-all-revisions-and-save-the-cleaned-document-as-do.cs- Task: After comparison, programmatically accept all revisions and save the cleaned document as DOCX.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
after-accepting-revisions-remove-all-revision-marks-by-clearing-the-revisions-collection.cs- Task: After accepting revisions, remove all revision marks by clearing the Revisions collection.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
generate-a-summary-report-of-added-deleted-and-modified-paragraphs-using-the-revisions-col.cs- Task: Generate a summary report of added, deleted, and modified paragraphs using the Revisions collection.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
save-the-compared-document-as-doc-format-while-preserving-all-revision-metadata.cs- Task: Save the compared document as DOC format while preserving all revision metadata.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
save-the-compared-document-as-docx-format-while-preserving-all-revision-metadata.cs- Task: Save the compared document as DOCX format while preserving all revision metadata.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
implement-error-handling-to-catch-exceptions-thrown-when-loading-unsupported-file-formats.cs- Task: Implement error handling to catch exceptions thrown when loading unsupported file formats during comparison.
- Workflow: native-comparison-api
- Outputs: docx
- Selected engine: mcp
use-a-disposable-pattern-to-ensure-document-objects-are-properly-released-after-comparison.cs- Task: Use a disposable pattern to ensure Document objects are properly released after comparison operations.
- Workflow: native-comparison-api
- Outputs: docx
- Selected engine: mcp
validate-that-the-comparison-output-matches-the-online-tool-results-by-comparing-revision.cs- Task: Validate that the comparison output matches the online tool results by comparing revision counts and types.
- Workflow: revision-processing
- Outputs: docx
- Selected engine: mcp
Common failure patterns and preferred agent fixes
- Identical document comparison
- Symptom: Comparison yields no revisions when differences were expected.
- Preferred fix: Create deterministic local source documents with meaningful differences before calling Compare.
- Invented revision reporting
- Symptom: Counts or revision metadata are reported without inspecting the real revisions collection.
- Preferred fix: Use document.Revisions directly and filter actual revision items.
- Missing local source documents
- Symptom: Existing DOCX/DOC/folder/stream inputs are assumed to exist.
- Preferred fix: Bootstrap local versions, folders, or MemoryStream-backed documents in the example.
- Incorrect post-processing assumption
- Symptom: Accept/reject workflows do not verify the final revision state.
- Preferred fix: Check document.Revisions.Count after accepting or rejecting revisions.
- Nullable warnings
- Symptom: CS8600, CS8602, or CS8604 around maybe-null nodes or filtered results.
- Preferred fix: Use nullable locals and null-check before dereference or assignment.
Build and run contract
- Target framework:
net8.0 - Package:
Aspose.Words26.9.0
Command reference
Create a temporary console project
dotnet new console -n ExampleProject --framework net8.0
cd ExampleProjectAdd required packages
dotnet add package Aspose.Words --version 26.9.0Copy a category example into the temp project
Copy-Item ..\comparison\<example-file>.cs .\Program.csBuild and run
dotnet build --configuration Release --verbosity minimal
dotnet run --configuration Release --no-buildCategory 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.
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
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.

