agentleFS
aspose-cellsaspose-cells/agentic-net-examples/working-with-html/AGENTS.md

agentic-net-examples / working-with-html

AGENTS.md1 starsChanged 2 months 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…

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
  1. Very specific:

    Create focused C# examples for Excel-to-HTML export and HTML-to-workbook import.

    line 22
  2. Distinctive:

    Use explicit HTML format/options for streams.

    line 72
  3. Distinctive:

    Use explicit types, deterministic content, one HTML feature, UTF-8, a concrete output/resource expectation, and metadata.

    line 85
  4. Distinctive:

    Treat HTML as untrusted: limit input/resource size, reject unsafe paths and remote fetching, avoid logging content, and apply …

    line 87
  5. Very specific:

    Use HtmlSaveOptions for Excel-to-HTML and HtmlLoadOptions for HTML-to-Excel.

    line 91

≈ “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.

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

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

GoalAPI
Export HTMLWorkbook.Save(..., HtmlSaveOptions)
Configure exportHtmlSaveOptions
Import HTMLHtmlLoadOptions
Custom CSS/image streamsIStreamProvider, StreamProviderOptions
Export selected areaExportArea or print-area options
  • Use explicit HTML format/options for streams.
  • ExportActiveWorksheetOnly uses 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.

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.