1. Products
  2.   Diagram
  3.   .NET
  4.   Aspose.Diagram for .NET

Aspose.Diagram for .NET

 
 

C# .NET API to Create, Edit & Convert Visio Diagrams

A Powerful Visio Diagraming API to create, edit, manipulate, & convert Visio files to XPS, HTML, SVG, SWF, XAML, images or PDF formats.

What is Aspose.Diagram for .NET?

Aspose.Diagram for .NET is a handy tool for developers working with Visio Diagrams in C# applications. This library enables you to easily create, edit, and convert Microsoft Visio Diagrams. It offers a wide range of features for managing shapes and pages in Visio diagrams. With this tool, you can add, remove, and customize shapes, adjusting properties like size, position, and appearance. Whether you are working on a server or a client application, this library is optimized to deliver efficient performance. It offers many practical advantages. It allows users to seamlessly handle Microsoft Visio diagrams by reading, writing, and converting them to different formats like VSDX, VSX, VTX, VDX, VSSX, VSTX, VSDM, VSSM, VSD, VSS, VST, and VDW. This feature empowers developers to interact with Visio diagrams in a way that fits their requirements, whether it’s for teamwork, examination, or showcasing.

Aspose.Diagram for .NET offers helpful tools to manage various page settings in Visio diagrams. You can adjust page size, orientation, and margins, as well as control the visibility and order of layers and sections. The software allows you to work with Visio connectors and Font Information, merge different diagrams, insert or duplicate pages, format Visio Pages, handle page size, extract Images, add hyperlinks to Visio shapes, include watermarks in Images, process raw data, replacing a picture shape, create fields, add or retrieve or copy Visio Shape Data and replace text. In addition to its core functionality, the library also provides a range of advanced features, such as support for macros and plugins, and the ability to perform calculations using built-in functions. This allows developers to create complex and sophisticated Visio diagrams and perform data analysis as well as generate reports with ease.

Previous Next

Getting Started with Aspose.Diagram for .NET

The recommend way to install Aspose.Diagram for .NET is using NuGet. Please use the following command for a smooth installation.

Install Aspose.Diagram for .NET via NuGet

Install-Package Aspose.Pdf 
You can also download it directly from Aspose product page.

Create Visio Diagrams via C# .NET API

Aspose.Diagram for .NET has included complete support for creating and manipulating Visio diagrams programmatically without using Microsoft Visio. The library allows users to handle diagram’s shapes and their properties with ease. It supports layout shapes feature to automatically position shapes faster as compare to the manual way. The library also supports working with VBA module code automatically and allows users to extract and modify VBA module code. Using Aspose.Diagram, you can create new Visio diagrams from scratch or load existing ones, add and manipulate shapes, text, and other elements, and save the modified diagrams to disk or stream.

How to Create New Diagram from the Scratch via .NET API?

string dataDir = RunExamples.GetDataDir_LoadSaveConvert();

// Initialize a Diagram class
Diagram diagram = new Diagram();

// Save diagram in the VSDX format
diagram.Save(dataDir + "CreateNewVisio_out.vsdx", SaveFileFormat.VSDX);

Convert Visio Diagrams to Other File Formats via C# API

Aspose.Diagram for .NET is convenient and efficient solution enables software developers to open and convert Microsoft Visio diagrams to various file formats inside their own .NET applications. The library supports Visio diagrams conversion to some popular file formats such as PDF, XPS HTML, EMF, SWF, XAML, JPEG, PNG, BMP, TIFF, SVG, EMF, and many more. The conversion process is fast and efficient, and the output file is accurate and of high quality. The library supports some important features, such as splitting pages, converting Visio drawing with selective shapes, modifying existing shapes, and so on.

How to Export Microsoft Visio Drawing to PDF via C# API?

string dataDir = RunExamples.GetDataDir_LoadSaveConvert();

// Call the diagram constructor to load a VSD diagram
Diagram diagram = new Diagram(dataDir + "ExportToPDF.vsd");

MemoryStream pdfStream = new MemoryStream();
// Save diagram
diagram.Save(pdfStream, SaveFileFormat.PDF);

// Create a PDF file
FileStream pdfFileStream = new FileStream(dataDir + "ExportToPDF_out.pdf", FileMode.Create, FileAccess.Write);
pdfStream.WriteTo(pdfFileStream);
pdfFileStream.Close();

pdfStream.Close();

// Display Status.
System.Console.WriteLine("Conversion from vsd to pdf performed successfully.");

Add & Manage Shapes in Visio Files via .NETAPI

Aspose.Diagram for .NET allows software developers to insert shapes into Visio diagrams and manage its properties with ease. The library supports several important features for handling Visio shapes, such as add new shape, retrieve and modify existing shape, convert Visio shape to HTML or image, copy existing shape, connect shapes with each other, manage Shapes Paragraph, Shapes Gluing support, Visio TimeLine Shapes, calculate Pin Values, setting Size of a shape, apply theme to shape, group, convert and verify shapes and many more.

How to Retrieve Shape Information from Visio Diagram via C# API?

string dataDir = RunExamples.GetDataDir_Shapes();

// Load diagram
Diagram vsdDiagram = new Diagram(dataDir + "RetrieveShapeInfo.vsd");

foreach (Aspose.Diagram.Shape shape in vsdDiagram.Pages[0].Shapes)
{
    // Display information about the shapes
    Console.WriteLine("\nShape ID : " + shape.ID);
    Console.WriteLine("Name : " + shape.Name);
    Console.WriteLine("Master Shape : " + shape.Master.Name);
}

Insert & Edit Text in Visio Diagrams via .NET API

Aspose.Diagram for .NET allows software developers to working with Visio in different ways inside Visio Diagrams using .NET library. The C# library has include different features for handling text in shapes, such as inserting text shape, customize text shape in the Visio diagram, update the shape’s text, find and replace the shape’s text, apply Built-in or custom style-sheet to text, apply different style on the each text value of a shape, extract plain Text from the Visio diagram page and many more.

How to Add Text Shape in the Visio Diagram via .NET API?

string dataDir = RunExamples.GetDataDir_ShapeText();

// Create a new diagram
Diagram diagram = new Diagram();
// Set parameters and add text to a Visio page
double PinX = 1, PinY = 1, Width = 1, Height = 1;                  
diagram.Pages[0].AddText(PinX, PinY, Width, Height, "Test text");
// Save diagram 
diagram.Save(dataDir + "InsertTextShape_out.vsdx", SaveFileFormat.VSDX);
 English