Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active March 17, 2022 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/9d1cd3f3065256f5639383cd4e8238fb to your computer and use it in GitHub Desktop.
Save aspose-com-gists/9d1cd3f3065256f5639383cd4e8238fb to your computer and use it in GitHub Desktop.
Convert Visio VSD VSDX file to Word DOCX or DOC Document Programmatically in Java
// Create a diagram object to load input VSD/VSDX Visio diagram
Diagram diagram = new Diagram("Diagram.vsd");
// Create ByteArrayOutputStream and save the diagram as PDF
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// Convert Visio VSD or VSDX to PDF format
diagram.save(baos, SaveFileFormat.PDF);
// Load the input PDF file from the ByteArrayOutputStream
com.aspose.pdf.Document document = new com.aspose.pdf.Document(baos.toByteArray());
// Set properties for the output word document
DocSaveOptions options = new DocSaveOptions();
options.setRecognizeBullets(true);
options.setFormat(DocFormat.Doc);
// Save output DOC Word file
document.save("Test.doc");
// Create a diagram object to load input VSD/VSDX Visio diagram
Diagram diagram = new Diagram("Diagram.vsd");
// Create ByteArrayOutputStream and save the diagram as PDF
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// Convert Visio VSD or VSDX to PDF format
diagram.save(baos, SaveFileFormat.PDF);
// Load the input PDF file from the ByteArrayOutputStream
com.aspose.pdf.Document document = new com.aspose.pdf.Document(baos.toByteArray());
// Set properties for the output word document
DocSaveOptions options = new DocSaveOptions();
options.setRecognizeBullets(true);
options.setFormat(DocFormat.DocX);
// Save output DOCX Word file
document.save("Test.docx");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment