agentic-net-examples / range
AGENTS.md4 starsChanged 3 months agoMITView on GitHub
Verified C# examples for range 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
- comparisonAGENTS.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
- 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, 6 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Use documented Aspose.Words APIs only.
- Distinctive: line 18
Create local sample inputs when needed.
- Distinctive: line 19
Keep validation narrow and task-specific.
- Distinctive: line 26
Use the simplest workflow that satisfies the task.
- Distinctive: line 239
When replacing a file, prefer the latest verified publish-ready version rather than a merely compiling draft.
- Distinctive: line 240
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 - Range
Purpose
This folder is a live, curated example set for Range 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 documented Aspose.Words APIs only.
- Create local sample inputs when needed.
- Keep validation narrow and task-specific.
- Save outputs when required.
Recommended workflow selection
- Range Workflow workflow: 30 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
extract-plain-unformatted-text-from-a-document-using-the-range-text-property.cs- Task: Extract plain unformatted text from a document using the Range.Text property.
- Workflow: range-workflow
- Outputs: doc
- Selected engine: mcp
extract-plain-text-of-each-section-via-each-section-s-range-text-property.cs- Task: Extract plain text of each section via each section's Range.Text property.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
use-the-range-object-to-extract-plain-text-from-a-header-and-footer-for-indexing.cs- Task: Use the Range object to extract plain text from a header and footer for indexing.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
generate-a-plain-text-version-of-a-document-by-extracting-each-section-s-range-text.cs- Task: Generate a plain-text version of a document by extracting each section's Range.Text.
- Workflow: range-workflow
- Outputs: doc
- Selected engine: mcp
retrieve-the-count-of-bookmarks-within-a-range.cs- Task: Retrieve the count of bookmarks within a range.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
retrieve-the-count-of-form-fields-within-a-range.cs- Task: Retrieve the count of form fields within a range.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
iterate-through-each-bookmark-in-a-range-and-output-its-name.cs- Task: Iterate through each bookmark in a range and output its name.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
iterate-over-bookmarks-in-a-range-and-modify-their-names.cs- Task: Iterate over bookmarks in a range and modify their names.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
add-a-new-bookmark-at-the-start-of-the-document-using-range-bookmarks.cs- Task: Add a new bookmark at the start of the document using Range.Bookmarks.
- Workflow: range-workflow
- Outputs: doc
- Selected engine: mcp
remove-a-specific-bookmark-by-locating-its-range-and-calling-remove.cs- Task: Remove a specific bookmark by locating its range and calling Remove.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
clear-the-text-of-a-specific-bookmark-s-range-without-deleting-the-bookmark.cs- Task: Clear the text of a specific bookmark's range without deleting the bookmark.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
replace-text-within-a-range-by-assigning-a-new-string-to-the-range-text-property.cs- Task: Replace text within a range by assigning a new string to the Range.Text property.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
search-for-a-specific-phrase-within-a-range-and-replace-it-with-another-string.cs- Task: Search for a specific phrase within a range and replace it with another string.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
perform-a-case-insensitive-search-within-a-range-and-collect-matching-paragraph-indices.cs- Task: Perform a case-insensitive search within a range and collect matching paragraph indices.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
insert-new-text-at-the-beginning-of-a-range.cs- Task: Insert new text at the beginning of a range.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
append-text-to-the-end-of-a-range.cs- Task: Append text to the end of a range.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
copy-paragraph-s-range-content-into-a-string-variable-for-further-processing.cs- Task: Copy paragraph's range content into a string variable for further processing.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
delete-all-characters-in-a-document-s-body-by-calling-delete-on-doc-range.cs- Task: Delete all characters in a document's body by calling Delete on doc.Range.
- Workflow: range-workflow
- Outputs: doc
- Selected engine: mcp
save-the-document-after-removing-all-content-from-its-range-to-create-an-empty-template.cs- Task: Save the document after removing all content from its range to create an empty template.
- Workflow: range-workflow
- Outputs: doc
- Selected engine: mcp
implement-a-batch-process-that-clears-the-content-of-multiple-documents-using-doc-range-de.cs- Task: Implement a batch process that clears the content of multiple documents using doc.Range.Delete.
- Workflow: range-workflow
- Outputs: doc
- Selected engine: mcp
iterate-over-form-fields-in-a-range-and-list-their-names-and-types.cs- Task: Iterate over form fields in a range and list their names and types.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
create-a-checkbox-form-field-inside-a-specific-range-and-set-its-default-state.cs- Task: Create a checkbox form field inside a specific range and set its default state.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
update-the-value-of-a-text-input-form-field-located-in-a-given-range.cs- Task: Update the value of a text input form field located in a given range.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
delete-all-form-fields-within-a-document-by-iterating-over-range-formfields-and-calling-re.cs- Task: Delete all form fields within a document by iterating over Range.FormFields and calling Remove.
- Workflow: range-workflow
- Outputs: doc
- Selected engine: mcp
validate-that-a-range-contains-no-form-fields-before-performing-a-text-replacement-operati.cs- Task: Validate that a range contains no form fields before performing a text replacement operation.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
generate-a-summary-report-of-bookmark-names-and-their-corresponding-text-extracted-from-ra.cs- Task: Generate a summary report of bookmark names and their corresponding text extracted from ranges.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
replace-placeholder-text-inside-a-range-with-dynamic-data-retrieved-from-a-database.cs- Task: Replace placeholder text inside a range with dynamic data retrieved from a database.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
implement-a-script-that-removes-all-bookmarks-and-form-fields-from-a-document-range-before.cs- Task: Implement a script that removes all bookmarks and form fields from a document range before publishing.
- Workflow: range-workflow
- Outputs: doc
- Selected engine: mcp
log-the-names-of-all-bookmarks-found-in-a-range-for-debugging.cs- Task: Log the names of all bookmarks found in a range for debugging.
- Workflow: range-workflow
- Outputs: docx
- Selected engine: mcp
export-the-extracted-plain-text-from-a-range-to-a-txt-file-while-preserving-line-breaks.cs- Task: Export the extracted plain text from a range to a .txt file while preserving line breaks.
- Workflow: range-workflow
- Outputs: txt
- Selected engine: mcp
Common failure patterns and preferred agent fixes
- Unsupported API invention
- Symptom: Generated code references members that do not exist in the selected package version.
- Preferred fix: Replace invented members with documented Aspose.Words APIs already proven in this category.
- Missing local bootstrap inputs
- Symptom: The example assumes source files, folders, images, or data already exist.
- Preferred fix: Create deterministic local inputs before loading, processing, or validating them.
- Over-broad validation
- Symptom: The example fails at runtime while checking unrelated document internals.
- Preferred fix: Validate only the requested behavior and the existence of expected outputs.
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 ..\range\<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.

