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

agentic-net-examples / working-with-tables

AGENTS.md1 starsChanged 2 months agoMITView on GitHub

Create focused C# examples for structured Excel tables (ListObject). Follow ../AGENTS.md, then this guide. Existing generated examples require independent API and runtime validation. In scope: create/name/find/enumerate/resize/delete tables, columns, styles, header/totals/bands, filters, calculated columns, totals, membership, and conversion to a range. Out of scope: generic cells or ranges, formula calculation itself, slicers and pivot tables, and external query authentication or execution. Use explicit types, deterministic headers/data, one table capability, a valid unique display name, and metadata describing input/output and expected state.…

The file

We split this AGENTS.md into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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 structured Excel tables (ListObject).

    line 22
  2. Distinctive:

    Use explicit types, deterministic headers/data, one table capability, a valid unique display name, and metadata describing input/output and …

    line 82
  3. Very specific:

    Use ListObjects.Add to create a table, TableStyleType for a built-in style, ShowTotals and column total settings for totals, AutoFilter for …

    line 88

≈ “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 Tables Agent Instructions

Mission and boundary

Create focused C# examples for structured Excel tables (ListObject). Follow ../AGENTS.md, then this guide. Existing generated examples require independent API and runtime validation.

In scope: create/name/find/enumerate/resize/delete tables, columns, styles, header/totals/bands, filters, calculated columns, totals, membership, and conversion to a range.

Out of scope: generic cells or ranges, formula calculation itself, slicers and pivot tables, and external query authentication or execution.

Canonical answer

using System;
using Aspose.Cells;
using Aspose.Cells.Tables;

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells["A1"].PutValue("Product");
worksheet.Cells["B1"].PutValue("Quantity");
worksheet.Cells["A2"].PutValue("Notebook");
worksheet.Cells["B2"].PutValue(12);
worksheet.Cells["A3"].PutValue("Pen");
worksheet.Cells["B3"].PutValue(30);

int index = worksheet.ListObjects.Add("A1", "B3", true);
ListObject table = worksheet.ListObjects[index];
table.DisplayName = "InventoryTable";
table.TableStyleType = TableStyleType.TableStyleMedium2;

if (worksheet.ListObjects.Count != 1 ||
    table.DisplayName != "InventoryTable")
{
    throw new InvalidOperationException("The table was not created.");
}

workbook.Save("excel-table.xlsx");
Console.WriteLine("Created InventoryTable with two data rows.");

API truths and map

GoalAPI
Access tablesWorksheet.ListObjects
Create a tableListObjectCollection.Add
Configure tableListObject
Configure columnsListColumns, ListColumn
Apply built-in styleTableStyleType
Filter tableListObject.AutoFilter
Convert to rangeConvertToRange, TableToRangeOptions
  • Excel tables are ListObject instances; a styled range is not a table.
  • Add returns an index. Range endpoints are inclusive; numeric indexes are zero-based.
  • The header flag means the first range row already contains headers.
  • Headers must be nonempty, unique, and suitable for a table.
  • DisplayName must be valid, workbook-unique, contain no spaces, and not resemble a cell reference.
  • ConvertToRange removes table semantics even if formatting remains.
  • Filtering hides rows; it does not delete them.
  • Calculate formulas explicitly before validating calculated columns or totals.

Contract, validation, and safety

Use explicit types, deterministic headers/data, one table capability, a valid unique display name, and metadata describing input/output and expected state. Verify table count, range, columns, style, totals, filters, or absence after conversion; reopen the workbook when persistence matters.

Sanitize imported headers and table names, prevent formula injection, avoid credentials and external query execution, cap range sizes, cache table references, apply bulk changes, and save once. Do not confuse formatting with table semantics or filtering with deletion.

AI retrieval and FAQ

Use ListObjects.Add to create a table, TableStyleType for a built-in style, ShowTotals and column total settings for totals, AutoFilter for filters, and ConvertToRange to remove structured-table behavior.

Official resources

Definition of done

The example compiles, runs, creates or changes a real ListObject, verifies semantic table state and persisted output, and contains no unrelated query or UI 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.