How to Convert Visio to SVG in C#

How to Convert Visio to SVG in C#

Visio diagrams offer great help in drawing complex business flowcharts. You can use any diagramming software to make network diagrams using symbols and templates. However, you need to convert VSD/VSDX files to other popular file formats to meet business requirements. Therefore, in this blog post, you will learn how to convert Visio to SVG in C# programmatically. We will use this enterprise-level Visio file format library to achieve Visio to SVG, and Visio to HTML conversion.

We will cover the following points in this article:

Visio file format library installation

The installation process takes a few seconds which eventually saves production time. However, you can download the DLL files or install the API by running the following command in the NuGet package manager.

 Install-Package Aspose.Diagram 

Convert Visio to SVG Programmatically in C#

Now, we will perform the Visio to SVG conversion using a few lines of source code in a .NET application.

The steps are:

  1. Instantiate an instance of the Diagram class and load the source VSDX file.
  2. Create an object of the MemoryStream class to create a stream.
  3. Invoke the Save method to save the resultant SVG directly to a stream.
  4. Call the Save method to save the resultant SVG file.
  5. Read the stream into the terminal/console

Copy & paste the following code into your main file:

Visio to HTML Conversion in C#

Similarly, this Visio file format library provides methods to convert Visio to HTML programmatically in C#.

You may follow the steps below:

  1. Invoke the Diagram constructor to load a VSD diagram.
  2. Save the diagram file as an HTML file by calling the Save method.

The code snippet below shows how to convert Visio VSDX to HTML in C#:

You can see the output in the image below:

Visio to HTML in C#

Get a Free License

You can avail of a free temporary license to try the API without evaluation limitations.

Summing up

We are ending this blog post here. You have learned how to convert Visio to SVG in C# programmatically in C#. In addition, you also have gone through the Visio to HTML conversion in C# using this Visio file format library. Moreover, you can navigate the documentation to know the other features.

Moreover, we suggest you follow our Getting Started guide.

Finally, conholdate.com is writing new blog posts. So, please stay in touch for regular updates.

Ask a question

You can let us know about your questions or queries on our forum.

FAQs

How do I convert Visio to HTML?

Invoke the Diagram constructor to load a VSD diagram and save the diagram file as an HTML file by calling the Save method.

How do I save a Visio file as an SVG?

Follow this link to find the code snippet that demonstrates the Visio to SVG conversion programmatically.

See Also