1) Code:
public static void main(String[] args) throws Exception {
License license = new License();
license.setLicense(“Aspose.Diagram.lic”);
// The path to the documents directory.
String dataDir = Utils.getDataDir(CreateDiagram.class);
Diagram diagram = new Diagram();
String templateFileName = “E:\Editor.vss”;
FileInputStream stream = new FileInputStream(templateFileName);
String masterName = “Module Begin”;
diagram.addMaster(src, masterName);
diagram.addMaster(templateFileName, “Action”);
// Adds shape with defined PinX and PinY.
diagram.addShape(2.0, 2.0, masterName, 0);
diagram.addShape(3.0, 2.0, masterName, 0);
diagram.addShape(4.0, 2.0, masterName, 0);
diagram.addShape(5.0, 2.0, masterName, 0);
diagram.addShape(6.0, 6.0, masterName, 0);
// Initialize a new page object
Page newPage = new Page();
newPage.setName(“new page”);
newPage.setID(100);
diagram.getPages().add(newPage);
diagram.save(dataDir + “CDiagram.vdx”, SaveFileFormat.VDX);
}
2) Error Information:
Open VDX Processing Log
Source: E:\Lihu\03 Project\01 IPlatform\02 Eclipse\co-visio\src\main\resources\com\aspose\diagram\examples\Diagrams\CreateDiagram\CDiagram.vdx
Sun Jan 24 21:14:51 2016 Begin Session
[Warning] DataType:
Context: Line 1 — ID='7’
Description: This file contains a duplicate of an element that can exist only once. Visio has ignored the duplicate element.
[Warning] DataType:
Context: Line 1 — ID='10’
Description: This file contains a duplicate of an element that can exist only once. Visio has ignored the duplicate element.
3) The vdx file also can’t open by Visio 2003. I attached the error message. Please check it
Sun Jan 24 21:14:51 2016 End Session