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

agentic-net-examples / working-with-images

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

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

    Use Chart.ToImage; do not invent ChartRender or progress events.

    line 83
  2. Distinctive:

    Verify APIs against the installed package.

    line 93
  3. Very specific:

    Run dotnet build and dotnet run.

    line 94
  4. Distinctive:

    Use visual or pixel comparisons only in a fixed font/rendering environment.

    line 96
  5. Distinctive:

    Do not claim external integrations or third-party processing are Aspose.Cells features.

    line 99
  6. Distinctive:

    Do not render before layout is final, assume page zero is the only page, apply JPEG settings to every format, hard-code …

    line 103

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

GoalAPI
Render worksheet pagesSheetRender.ToImage
Read page countSheetRender.PageCount
Render worksheet TIFFSheetRender.ToTiff
Render workbookWorkbookRender
Render chartChart.ToImage
Configure format and qualityImageOrPrintOptions
Observe page savingIPageSavingCallback
  • 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.
  • Quality is 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 invent ChartRender or 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

  1. Verify APIs against the installed package.
  2. Run dotnet build and dotnet run.
  3. Assert PageCount, file/stream length, format signature, and stable dimensions where appropriate.
  4. Use visual or pixel comparisons only in a fixed font/rendering environment.
  5. Bound workbook size, page count, DPI, image dimensions, and concurrent rendering.
  6. Validate paths and never download untrusted remote assets implicitly.
  7. 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.

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.