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
- Convert Visio to SVG programmatically
- Visio to HTML conversion in .NET
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.
Convert Visio to SVG programmatically
Now, we will perform the Visio to SVG conversion using a few lines of source code in a .NET application.
The steps are:
- Instantiate an instance of the Diagram class and load the source VSDX file.
- Create an object of the MemoryStream class to create a stream.
- Invoke the Save method to save the resultant SVG directly to a stream.
- Call the Save method to save resultant SVG file.
- Read the stream into the terminal/console
Copy & paste the following code into your main file:
Visio to HTML conversion in .NET
Similarly, this Visio file format library provides methods to convert Visio to HTML programmatically.
You may follow the steps and the code snippet below:
- Invoke the Diagram constructor to load a VSD diagram.
- Save the diagram file as an HTML file by calling the Save method.
You can see the output in the image below:
Get a Free License
You can avail a free temporary license to try the API without evaluation limitations.
We are ending this blog post here. You have learned how to convert Visio to SVG in C# programmatically. In addition, you also have gone through the Visio to HTML conversion 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.
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.