![Visio VSDX to Word DOCX csharp](images/Visio-to-Word.jpeg#center)
Visio files can contain text, lines, or shapes to create drawings like a flowchart, organizational chart, etc. In some scenarios, you may want to convert a Visio drawing to a Word document in DOC or DOCX file format. Accordingly, this article explains how to convert a VSD or VSDX diagrams file to a Word document in DOC or DOCX file format programmatically in C#.
- VSD/VSDX to Word DOC or DOCX Converter – C# API Installation
- Convert Visio VSD/VSDX Diagram to Word DOC Document in C#
- Convert Visio VSD/VSDX Diagram to Word DOCX Programmatically in C#
VSD/VSDX to Word DOC or DOCX Converter – C# API Installation
In order to convert a Visio file to a Word document, you need to follow a two-step procedure. Firstly, you need to convert the input VSD or VSDX file to PDF format using Aspose.Diagram for .NET API. Next, you need to convert the PDF file to a Word document in DOC or DOCX format with Aspose.PDF for .NET API. You can access the APIs from the Downloads section or with the NuGet installation commands below:
PM> Install-Package Aspose.Diagram
PM> Install-Package Aspose.PDF
Convert Visio VSD/VSDX Diagram to Word DOC Document in C#
You can convert a VSD or VSDX file to a Word document in DOC format with the following steps:
- Load the input VSD or VSDX file using the Diagram class.
- Convert the Visio file to intermediary PDF file.
- Export the PDF file to a Word document in DOC format with the Document class.
The code snippet below shows how to convert a VSD or VSDX diagram to a Word document in DOC format programmatically in C#:
// Create a diagram object to load input VSD/VSDX Visio diagram | |
Diagram diagram = new Diagram("Diagram.vsd"); | |
// Create memory stream and save the diagram as PDF | |
MemoryStream stream = new MemoryStream(); | |
// Convert Visio VSD or VSDX to PDF format | |
diagram.Save(stream, SaveFileFormat.PDF); | |
// Load the input PDF file from the stream | |
Aspose.Pdf.Document document = new Aspose.Pdf.Document(stream); | |
// Set properties for the output word document | |
DocSaveOptions options = new DocSaveOptions(); | |
options.RecognizeBullets = true; | |
options.Format = DocSaveOptions.DocFormat.Doc; | |
// Save output DOC Word file | |
document.Save("Test.doc"); |
Convert Visio VSD/VSDX Diagram to Word DOCX Programmatically in C#
You can convert a VSD or VSDX file to a DOCX Word file by following the steps below:
- Load the input VSD or VSDX file with the Diagram class.
- Convert the Visio file to an intermediate PDF document using the Save method.
- Render the PDF file to DOCX Word document using the Document class.
The code snippet below demonstrates how to convert a VSD or VSDX Visio diagram to a Word document in DOCX format programmatically in C#:
// Create a diagram object to load input VSD/VSDX Visio diagram | |
Diagram diagram = new Diagram("Diagram.vsd"); | |
// Create memory stream and save the diagram as PDF | |
MemoryStream stream = new MemoryStream(); | |
// Convert Visio VSD or VSDX to PDF format | |
diagram.Save(stream, SaveFileFormat.PDF); | |
// Load the input PDF file from the stream | |
Aspose.Pdf.Document document = new Aspose.Pdf.Document(stream); | |
// Set properties for the output word document | |
DocSaveOptions options = new DocSaveOptions(); | |
options.RecognizeBullets = true; | |
options.Format = Aspose.Pdf.DocSaveOptions.DocFormat.DocX; | |
// Save output DOCX Word file | |
document.Save("Test.docx"); |
Get Free API License
You can try all the features of the API without any limitation with a free temporary license.
Conclusion
In this article, you have explored how to convert a VSD or VSDX file to a Word document as a DOC or DOCX file programmatically in C#. Moreover, you can go through the documentation to check other supported features. In case of any queries, please reach out to us at the forum.