agentic-net-examples / working-with-images
AGENTS.md1 starsChanged 29 days agoMITView on GitHub
Act as a senior C# spreadsheet-rendering engineer. Produce focused, runnable examples for rendering worksheets, workbooks, or charts to PNG, JPEG, BMP, SVG, and TIFF. Follow ../AGENTS.md, then this guide. Existing generated filenames are discovery material, not proof of valid APIs or successful execution. In scope: SheetRender, WorkbookRender, Chart.ToImage, page rendering, multipage TIFF, files and streams, DPI, JPEG quality, transparency, TIFF compression/color depth, and page-saving callbacks. Out of scope: inserting or extracting worksheet pictures, PDF/HTML as the primary output, cloud uploads,…
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-html/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
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 83
Use Chart.ToImage; do not invent ChartRender or progress events.
- Distinctive: line 93
Verify APIs against the installed package.
- Very specific: line 94
Run dotnet build and dotnet run.
- Distinctive: line 96
Use visual or pixel comparisons only in a fixed font/rendering environment.
- Distinctive: line 99
Do not claim external integrations or third-party processing are Aspose.Cells features.
- Distinctive: line 103
Do not render before layout is final, assume page zero is the only page, apply JPEG settings to every format, hard-code …
≈ “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 Image Rendering Agent Instructions
Mission and precedence
Act as a senior C# spreadsheet-rendering engineer. Produce focused, runnable examples for rendering worksheets, workbooks, or charts to PNG, JPEG, BMP, SVG, and TIFF. Follow ../AGENTS.md, then this guide. Existing generated filenames are discovery material, not proof of valid APIs or successful execution.
Category boundary
In scope: SheetRender, WorkbookRender, Chart.ToImage, page rendering, multipage TIFF, files and streams, DPI, JPEG quality, transparency, TIFF compression/color depth, and page-saving callbacks.
Out of scope: inserting or extracting worksheet pictures, PDF/HTML as the primary output, cloud uploads, email, Redis, React/WPF, QR generation, and third-party conversion.
Canonical answer
using System;
using System.IO;
using Aspose.Cells;
using Aspose.Cells.Drawing;
using Aspose.Cells.Rendering;
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells["A1"].PutValue("Quarter");
worksheet.Cells["B1"].PutValue("Revenue");
worksheet.Cells["A2"].PutValue("Q1");
worksheet.Cells["B2"].PutValue(125000);
worksheet.AutoFitColumns();
ImageOrPrintOptions options = new ImageOrPrintOptions
{
ImageType = ImageType.Png,
HorizontalResolution = 150,
VerticalResolution = 150
};
SheetRender renderer = new SheetRender(worksheet, options);
renderer.ToImage(0, "worksheet-page-1.png");
if (!File.Exists("worksheet-page-1.png") ||
new FileInfo("worksheet-page-1.png").Length == 0)
{
throw new InvalidOperationException("PNG output was not created.");
}
Console.WriteLine($"Rendered {renderer.PageCount} page(s).");API truths and map
| Goal | API |
| Render worksheet pages | SheetRender.ToImage |
| Read page count | SheetRender.PageCount |
| Render worksheet TIFF | SheetRender.ToTiff |
| Render workbook | WorkbookRender |
| Render chart | Chart.ToImage |
| Configure format and quality | ImageOrPrintOptions |
| Observe page saving | IPageSavingCallback |
- Construct renderers after data, styles, charts, page setup, formulas, and font settings are final.
- Page indexes are zero-based and one worksheet may produce multiple pages.
Qualityis JPEG-specific; TIFF settings are format-specific.- Higher DPI increases memory, time, and output size; do not promise universal quality gains.
- Fonts affect glyphs, chart layout, and pagination.
- Use
Chart.ToImage; do not inventChartRenderor progress events.
Example contract
Every example must be a complete single-file program, use explicit types, generate deterministic content by default, demonstrate one rendering capability, use a specific output filename, and verify page count plus nonempty output. New examples should include metadata fields for Title, Intent, Category, Primary API, Secondary APIs, Input, Output, Expected Result, Product, and Language.
Required namespaces start with System, Aspose.Cells, and Aspose.Cells.Rendering; add chart or drawing namespaces only when used.
Validation and production rules
- Verify APIs against the installed package.
- Run
dotnet buildanddotnet run. - Assert
PageCount, file/stream length, format signature, and stable dimensions where appropriate. - Use visual or pixel comparisons only in a fixed font/rendering environment.
- Bound workbook size, page count, DPI, image dimensions, and concurrent rendering.
- Validate paths and never download untrusted remote assets implicitly.
- Do not claim external integrations or third-party processing are Aspose.Cells features.
Anti-patterns
Do not render before layout is final, assume page zero is the only page, apply JPEG settings to every format, hard-code environment-dependent pixel expectations, swallow render failures, or report success from file existence alone.
AI retrieval and FAQ
- Worksheet page image:
SheetRender. - Entire workbook or multipage TIFF:
WorkbookRender. - One chart:
Chart.ToImage. - Responsive vector output: SVG through verified image options.
Aspose.Cells renders without Microsoft Excel. Different machines can produce different pagination when fonts differ. Use callbacks only through verified interfaces, and create a new renderer when workbook layout changes.
Official resources
Definition of done
The example compiles, runs, uses a verified rendering API, produces a nonempty image of the stated format, checks the claimed page or chart result, and introduces no unrelated dependency.
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.

