Hi Aspose,
I am trying to insert some data to my valid Visio file as below:
private static void testInsertSolutionXML() throws Exception {Test_20171012.zip (122.3 KB)
System.out.println("testInsertSolutionXML");
try (InputStream in = new FileInputStream("D:\\tmp\\Tuyen\\Visio\\Test_20171012.vsdx");
OutputStream out = new FileOutputStream("D:\\tmp\\Tuyen\\Visio\\Test_20171012_SolutionXML.vsdx")) {
Diagram document = new Diagram(in);
SolutionXML newXML = new SolutionXML();
newXML.setName("Solution XML");
newXML.setXmlValue("<doc-id>id1</doc-id>");
document.getSolutionXMLs().add(newXML);
System.out.println("Getting back solution xml: " + document.getSolutionXMLs().get("Solution XML").getXmlValue());
document.save(out, SaveFileFormat.VSDX);
}
}
The problem is the output file has invalid Visio format, that happens with the attached file only.
I’m using Aspose Diagram for Java 17.5.0. Can you have a look? Thank you.
Best Regards,
Tuyen
@vutuyen2636,
We managed to replicate the problem of invalid output VSDX drawing. It has been logged under the ticket ID DIAGRAMJAVA-50561 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.
@vutuyen2636,
The linked ticket ID DIAGRAMJAVA-50561 has been fixed. Please download and try the new version 17.10 of Aspose.Diagram for Java API.
Hi Imran,
Thanks for your support. I tried the latest Aspose Diagram for Java as you said and it seems that the issue is fixed. However, a new one comes: The output vsdx in the same source code misses some parts compared to the old one.
Please have a look at this attached screen shot:VSDX_missing_yellow_part.png (68.9 KB)
The yellow part is missed in the output vsdx file. Can you have a look again? Thank you.
Best Regards,
Tuyen
@vutuyen2636,
We have evaluated your ticket DIAGRAMJAVA-50561 with the latest version 17.10 of Aspose.Diagram for Java API and the highlighted part of the Visio drawing is not being missed. This is the output VSDX drawing: Test_20171012_SolutionXML17.10.zip (111.9 KB). Kindly open this Visio drawing into your environment, and then let us know how that goes.
Hi Imran,
Thanks for your response. I realize that your file is correct with expected SolutionXML inserted. However, using the same shared source code and the downloaded Aspose Java 17.10, I still have the same issue that some parts in the vsdx file are missed. I’m sure that I use the correct Aspose Java 17.10 version because if I use any old versions, the output vsdx file format is broken.
Can you share your source code to me? Even with a small difference in the source code, the output is different. This is what I learn from other Aspose libraries. Thank you.
Best Regards,
Tuyen
@vutuyen2636,
We have tried the following code example:
[Java]
String dataDir = "C:\\Diagram\\test2255\\";
InputStream in = new FileInputStream(dataDir + "Test_20171012.vsdx");
OutputStream out = new FileOutputStream(dataDir + "Test_20171012_SolutionXML_17.10.vsdx");
Diagram document = new Diagram(in);
SolutionXML newXML = new SolutionXML();
newXML.setName("Solution XML");
newXML.setXmlValue("<doc-id>id1</doc-id>");
document.getSolutionXMLs().add(newXML);
System.out.println("Getting back solution xml: " + document.getSolutionXMLs().get("Solution XML").getXmlValue());
document.save(out, SaveFileFormat.VSDX);
@imran.rafique,
Thanks for your support, it works fine now. The issue was that I did not load aspose license, that’s why some parts are missed.
@vutuyen2636,
It is nice to hear from you that the problem has been resolved. Please feel free to let us know whenever you require any further assistance.