This article covers the information to create Visio diagram in Java. It discusses the step-by-step program flow and a running code snippet to automate Visio diagram creation in Java. Furthermore, you can write the generated Visio diagram in a variety of Visio-supported file formats.
Steps to Create Visio Diagram in Java
- Configure the Aspose.Diagram library to make Visio diagrams from scratch
- Initiate an object of the Diagram class
- Use the stencil file to add a master
- Add a rectangular shape by invoking the addShape() method and specify various properties
- Render the generated Visio diagram using the save() method
These steps present an outline of how to create Visio in Java. First of all, make an empty diagram and initiate the stencil containing the master shapes. Next, append a shape while setting the location, dimensions, and target page number before exporting the output Visio diagram.
Code to Create Visio Diagram Programmatically in Java
You may work with the above sample code to draw any process diagram in Visio in Java. However, you can improvise it to add different shapes from the master stencil to meet your requirements. Likewise, the output Visio diagram can be exported as an image or a document, depending on your needs.
This brief article has summarized the details to create Visio diagram programmatically in Java. Whereas, if you want to learn how to convert VSD files, refer to the article on Convert VSD to VSDX in Java.