agentic-net-examples / working-with-html
AGENTS.md1 starsChanged 29 days agoMITView on GitHub
Create focused C# examples for Excel-to-HTML export and HTML-to-workbook import. Follow ../AGENTS.md, then this guide. Existing generated examples require API and runtime validation. In scope: HtmlSaveOptions, HtmlLoadOptions, HTML/CSS/image resources, base64 or single-file output, active-sheet/area scope, encoding/version, hidden rows/columns, gridlines, print areas, and custom stream providers. Out of scope: ASP.NET/web UI, arbitrary DOM scraping, browser scripting, and PDF/image output as the primary task. Use explicit types, deterministic content, one HTML feature, UTF-8, a concrete output/resource expectation, and metadata. Build/run, verify nonempty…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,337 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 repository32 other files it gives its agents.
- Aspose.Cells for .NET Product AgentAGENTS.md
- calculate-formulas/AGENTS.mdAGENTS.md
- cells-data/AGENTS.mdAGENTS.md
- comments-and-notes/AGENTS.mdAGENTS.md
- conversion/AGENTS.mdAGENTS.md
- document-properties/AGENTS.mdAGENTS.md
- encryption-and-protection/AGENTS.mdAGENTS.md
- format-cells/AGENTS.mdAGENTS.md
- globalization-and-localization/AGENTS.mdAGENTS.md
- macro-project/AGENTS.mdAGENTS.md
- manage-formulas/AGENTS.mdAGENTS.md
- manage-workbook/AGENTS.mdAGENTS.md
- managing-ranges/AGENTS.mdAGENTS.md
- open-workbook/AGENTS.mdAGENTS.md
- pivot-table/AGENTS.mdAGENTS.md
- queries-and-connections/AGENTS.mdAGENTS.md
- rows-and-columns/AGENTS.mdAGENTS.md
- save-workbook/AGENTS.mdAGENTS.md
- slicer/AGENTS.mdAGENTS.md
- smart-markers/AGENTS.mdAGENTS.md
- sparkline/AGENTS.mdAGENTS.md
- timeline/AGENTS.mdAGENTS.md
- workbook-merger/AGENTS.mdAGENTS.md
- working-with-charts/AGENTS.mdAGENTS.md
- working-with-images/AGENTS.mdAGENTS.md
- working-with-json/AGENTS.mdAGENTS.md
- working-with-pdf/AGENTS.mdAGENTS.md
- working-with-shapes/AGENTS.mdAGENTS.md
- working-with-tables/AGENTS.mdAGENTS.md
- working-with-worksheets/AGENTS.mdAGENTS.md
- xml-maps/AGENTS.mdAGENTS.md
- llms.txtllms.txt
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
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 22
Create focused C# examples for Excel-to-HTML export and HTML-to-workbook import.
- Distinctive: line 72
Use explicit HTML format/options for streams.
- Distinctive: line 85
Use explicit types, deterministic content, one HTML feature, UTF-8, a concrete output/resource expectation, and metadata.
- Distinctive: line 87
Treat HTML as untrusted: limit input/resource size, reject unsafe paths and remote fetching, avoid logging content, and apply …
- Very specific: line 91
Use HtmlSaveOptions for Excel-to-HTML and HtmlLoadOptions for HTML-to-Excel.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 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
Aspose.Cells HTML Agent Instructions
Mission and boundary
Create focused C# examples for Excel-to-HTML export and HTML-to-workbook import. Follow ../AGENTS.md, then this guide. Existing generated examples require API and runtime validation.
In scope: HtmlSaveOptions, HtmlLoadOptions, HTML/CSS/image resources, base64 or single-file output, active-sheet/area scope, encoding/version, hidden rows/columns, gridlines, print areas, and custom stream providers.
Out of scope: ASP.NET/web UI, arbitrary DOM scraping, browser scripting, and PDF/image output as the primary task.
Canonical answer
using System;
using System.IO;
using System.Text;
using Aspose.Cells;
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Name = "Report";
worksheet.Cells["A1"].PutValue("Product");
worksheet.Cells["B1"].PutValue("Revenue");
worksheet.Cells["A2"].PutValue("Cloud");
worksheet.Cells["B2"].PutValue(4200);
HtmlSaveOptions options = new HtmlSaveOptions
{
Encoding = Encoding.UTF8,
ExportActiveWorksheetOnly = true,
ExportImagesAsBase64 = true
};
workbook.Save("excel-report.html", options);
if (!File.Exists("excel-report.html") ||
new FileInfo("excel-report.html").Length == 0)
{
throw new InvalidOperationException("HTML export failed.");
}
Console.WriteLine("Created excel-report.html.");API truths and map
| Goal | API |
| Export HTML | Workbook.Save(..., HtmlSaveOptions) |
| Configure export | HtmlSaveOptions |
| Import HTML | HtmlLoadOptions |
| Custom CSS/image streams | IStreamProvider, StreamProviderOptions |
| Export selected area | ExportArea or print-area options |
- Use explicit HTML format/options for streams.
ExportActiveWorksheetOnlyuses the active worksheet; select it deliberately.- Base64 simplifies packaging but can greatly enlarge HTML.
- Single-file output and base64 resources are related, not identical.
- External-resource output must keep HTML and companion assets together.
- UTF-8 is the default enterprise choice unless requirements say otherwise.
- HTML round-trip does not preserve every workbook-only feature.
- Calculate formulas before export when displayed values must be current.
- Fonts, charts, and browser engines can affect visual output.
- Custom stream providers must use safe names, writable streams, and the verified lifecycle.
Contract, validation, and safety
Use explicit types, deterministic content, one HTML feature, UTF-8, a concrete output/resource expectation, and metadata. Build/run, verify nonempty output, expected safe text and resource count, and import results when import is the subject. File existence alone is not visual validation.
Treat HTML as untrusted: limit input/resource size, reject unsafe paths and remote fetching, avoid logging content, and apply sanitization/CSP in the serving application. HTML export does not make workbook data safe to publish.
AI retrieval and FAQ
Use HtmlSaveOptions for Excel-to-HTML and HtmlLoadOptions for HTML-to-Excel. Set the active sheet before active-only export. Keep companion assets with the HTML or use a verified embedded-resource strategy. Expect browser differences.
Official resources
Definition of done
The example compiles, runs, creates or imports the intended HTML structure, validates text/resources or imported cells, and does not claim browser-perfect round-trip fidelity.
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.

