Export MS Visio Diagram to XML (VDX, VTX, VSX) Formats in .NET Apps

This technical tip shows how .NET developers can export Microsoft Visio diagram to XML inside their own applications using Aspose.Diagram for .NET. Aspose.Diagram for .NET lets you export diagrams to a variety of formats: image formats, HTML, SVG, SWF and XML formats: <br/> <br/> • VDX defines an XML diagram. <br/> • VTX defines an XML template. <br/> • VSX defines an XML stencil. <br/> <br/> The Diagram class' constructors read a diagram and the Save method is used to save, or export, a diagram in a different file format. The code snippets in this article show how to use the Save method to save a Visio file to VDX, VTX and VSX. <br/>
//your code here... //Exporting VSD to VDX //Call the diagram constructor to load diagram from a VSD file Diagram diagram = new Diagram("D:\\Drawing1.vsd"); this.Response.Clear(); this.Response.ClearHeaders(); this.Response.ContentType = "application/vnd.ms-visio"; this.Response.AppendHeader("Content-Disposition", "attachment; filename=Diagram.vdx"); this.Response.Flush(); System.IO.Stream vdxStream = this.Response.OutputStream; //Save input VSD as VDX diagram.Save(vdxStream, SaveFileFormat.VDX); this.Response.End(); //Exporting from VSD to VSX // Call the diagram constructor to load diagram from a VSD file Diagram diagram = new Diagram("D:\\Drawing1.vsd"); this.Response.Clear(); this.Response.ClearHeaders(); this.Response.ContentType = "application/vnd.ms-visio"; this.Response.AppendHeader("Content-Disposition", "attachment; filename=Diagram.vsx"); this.Response.Flush(); System.IO.Stream vsxStream = this.Response.OutputStream; //Save input VSD as VSX diagram.Save(vsxStream, SaveFileFormat.VSX); this.Response.End();

Url: http://www.aspose.com/.net/diagram-component.aspx

Language: C# | User: Sheraz Khan | Created: Jan 29, 2014 | Tags: Visio diagram to XML, Visio Diagram conversion to XML, Export VSD to VDX, Export VSD to VSX, convert VSD diagram to VDX, convert Visio file to VSX, convert Visio Diagram to VTX Visio diagram to XML Export VSD to VDX Export VSD to VSX convert Visio file to VSX convert Visio Diagram to VTX