DEV Community

AsposeDiagram
AsposeDiagram

Posted on • Edited on

1

Convert Microsoft Visio Document to HTML in C#

Developers can convert any Microsoft Visio document to HTML (Hypertext Markup Language) in C# (or in any other .NET Framework supported language e.g. VB.NET etc) using Aspose.Diagram which is a light-weight, extensible, easy to use API, that helps developers to create, manipulate and convert Microsoft Visio files to various formats on client side and server-side without any need to install Microsoft Visio or using any sort of Microsoft Office automation.

Supported Platforms

Aspose.Diagram supports both .NET and Java platforms. Please see Aspose.Diagram for .NET and Aspose.Diagram for Java for your reference.

Sample Microsoft Visio Document - VSD

For demonstration purpose, we will convert the following sample Microsoft Visio document to HTML in C# using Aspose.Diagram API. However, you can use any Microsoft Visio document of your choice inside the sample code and it will also be converted to HTML fine.

Sample Microsoft Visio Document to be converted to HTML using Aspose.Diagram API.

Licensing

Please note, if you will execute the code without prior setting the Aspose.Diagram license, you will get Evaluation Watermark in your output documents. For more information, please go through Licensing.

Sample Code

The following sample code converts the Microsoft Visio document to HTML by performing these steps.

  • Load Microsoft Visio document to Aspose.Diagram.Diagram object.
  • Save the Aspose.Diagram.Diagram object into HTML format.
// Path for input and output documents directory.
string dirPath = @"D:\Download\";
// Load the sample Microsoft Visio document inside the Aspose.Diagram.Diagram object.
Aspose.Diagram.Diagram dg = new Diagram(dirPath + "sampleConvertMicrosoftVisioDocumenttoHTML.vsd");
// Save the Aspose.Diagram.Diagram object into HTML format.
dg.Save(dirPath + "Output.html", SaveFileFormat.HTML);

Output HTML by Aspose.Diagram

The following snapshot shows the Output HTML generated by Aspose.Diagram with the code given above. As you can see, the HTML looks exactly same as Microsoft Visio document.

Output HTML generated by Aspose.Diagram from Microsoft Visio document.

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay