Skip to content

Latest commit

 

History

6,818 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aspose.Diagram for .NET — Agentic Examples

AI-generated, compiler-validated C# examples for the Aspose.Diagram for .NET API.

Statistics

Metric Value
Total Examples 1840
Categories 31
Overall Pass Rate 100.0%
Aspose.Diagram Version 26.8.0
Target Framework net8.0
Last Updated 2026-08-31

Repository Structure

agents.md       ← AI agent instructions (root)
README.md       ← This file
index.json      ← Machine-readable catalogue
LICENSE         ← MIT licence
.github/
  workflows/
    validate-pr.yml  ← CI validation
basic-operations/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
convert-visio-document/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
diagram-conversions/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
diagram-vba/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
document-properties/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
drawing/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
events-section-in-the-shapesheet/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
font-operations/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
ole-objects-in-visio-diagram/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
page-setup-features/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
visio-activex-controls/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
visio-shape-gradient/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-comments/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-diagrams/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-external-data-sources/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-fields/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-geometry-section/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-headers-and-footers/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-hyperlinks/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-images/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-layers/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-masters/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-pages/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-protection/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-shapes/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-solutionxml-elements/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-text/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-text-boxes/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-themes/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-user-defined-cells/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files
working-with-window-elements/
  agents.md    ← Category AI instructions
  index.json   ← Category catalogue
  *.cs         ← Example files

Categories

Category Examples Pass Rate agents.md
Basic Operations 30 100.0% agents.md
Convert Visio Document 30 100.0% agents.md
Diagram Conversions 96 100.0% agents.md
Diagram Vba 35 100.0% agents.md
Document Properties 34 100.0% agents.md
Drawing 125 100.0% agents.md
Events Section In The Shapesheet 33 100.0% agents.md
Font Operations 30 100.0% agents.md
Ole Objects In Visio Diagram 30 100.0% agents.md
Page Setup Features 82 100.0% agents.md
Visio Activex Controls 30 100.0% agents.md
Visio Shape Gradient 30 100.0% agents.md
Working With Comments 35 100.0% agents.md
Working With Diagrams 40 100.0% agents.md
Working With External Data Sources 29 100.0% agents.md
Working With Fields 33 100.0% agents.md
Working With Geometry Section 36 100.0% agents.md
Working With Headers And Footers 30 100.0% agents.md
Working With Hyperlinks 35 100.0% agents.md
Working With Images 38 100.0% agents.md
Working With Layers 30 100.0% agents.md
Working With Masters 29 100.0% agents.md
Working With Pages 168 100.0% agents.md
Working With Protection 35 100.0% agents.md
Working With Shapes 459 100.0% agents.md
Working With Solutionxml Elements 34 100.0% agents.md
Working With Text 89 100.0% agents.md
Working With Text Boxes 35 100.0% agents.md
Working With Themes 40 100.0% agents.md
Working With User Defined Cells 30 100.0% agents.md
Working With Window Elements 30 100.0% agents.md

How to Use

git clone https://github.com/aspose-diagram/agentic-net-examples.git
cd <category-folder>
# Copy any .cs file content into your project
# Ensure Aspose.Diagram.dll is referenced
dotnet build && dotnet run

Prerequisites

Agent Pipeline

Attempt Strategy Trigger
1 MCP direct retrieval + code assembly Always
2 MCP + injected API correction rules Attempt 1 fails
3 LLM repair with compiler errors + rules Attempt 2 fails

Validation

Every PR is automatically validated by GitHub Actions:

  • dotnet build — required, blocks merge on failure
  • dotnet run — informational only

Versioning

Each Aspose.Diagram release gets its own set of PRs validated against that version's DLL. Examples are tagged by version in index.json.

Contributing

Examples are generated automatically by the Aspose.Diagram Examples Generator Agent. To request new examples or report issues, open an issue on this repository. For AI agent instructions, see agents.md.

Aspose.Diagram for .NET Capabilities

Aspose.Diagram for .NET is a class library for working with Microsoft Visio files programmatically in .NET applications. This repository demonstrates:

Capability Formats / Operations
Read Visio files VSDX, VSD, VDX, VSX, VTX, VSSX, VSTX
Write Visio files VSDX, VDX, VSDM, VSTM, VSSM
Export to image PNG, JPEG, BMP, TIFF, EMF, SVG
Export to document PDF, XPS, HTML, XAML
Shape operations Add, modify, connect, style, group shapes
Page operations Add, copy, move, resize, reorder pages
Theme operations Apply preset themes and variants
Text operations Add, update, format text in shapes
Data operations User-defined cells, custom properties, external data
VBA operations Read, modify, remove VBA projects

FAQ — Aspose.Diagram for .NET

How do I load a Visio file in C#?

using Aspose.Diagram;
Diagram diagram = new Diagram("input.vsdx");

How do I convert a Visio diagram to PDF?

using Aspose.Diagram;
using Aspose.Diagram.Saving;
Diagram diagram = new Diagram("input.vsdx");
diagram.Save("output.pdf", new PdfSaveOptions());

Why does using (Diagram diagram = ...) cause a compiler error?

Diagram does not implement IDisposable. Remove the using statement: Diagram diagram = new Diagram("input.vsdx");

Why does SaveFileFormat.VSDX cause CS0117?

SaveFileFormat enum members use PascalCase: SaveFileFormat.Vsdx, SaveFileFormat.Pdf, SaveFileFormat.Png — never ALL_CAPS.

How do I add a shape to a Visio diagram?

long shapeId = diagram.AddShape(pinX, pinY, width, height, "masterName", 0);
Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId);

How do I connect two shapes?

Shape connector = new Shape();
long connId = diagram.AddShape(connector, "Dynamic connector", 0);
diagram.Pages[0].ConnectShapesViaConnector(
    shape1Id, ConnectionPointPlace.Right,
    shape2Id, ConnectionPointPlace.Left, connId);

Evaluation and Benchmarks

All examples are compiler-validated before being committed. The benchmark is a 100% build pass rate across all generated examples.

Version Total Examples Pass Rate Framework
26.8.0 1840 100.0% net8.0

Pass rate is enforced by the agent pipeline — only examples that pass both dotnet build and dotnet run are committed to this repository.

How to Run Validation

Validation runs automatically on every pull request targeting main via GitHub Actions (.github/workflows/validate-pr.yml).

To trigger validation:

  1. Push your branch to GitHub
  2. Open a pull request targeting main
  3. GitHub Actions will automatically build and run all changed .cs files
  4. Build failures block the merge — runtime errors are informational only

Maintained by agent-aspose-diagram-examples · Aspose.Diagram for .NET · 2026-08-31

About

Aspose.Diagram for .NET — AI-generated, compiler-validated C# examples. Auto-generated via the Aspose.Diagram Examples Generator Agent. Agent-generated examples cover Visio diagram creation, shape operations, format conversion, OLE objects, and more.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages