Create a visio 2013 file in java

4.1k views Asked by At

I want to create a .vsdx file (drawing) using Java. Visio 2013 uses Open Packaging Convention. I don't know from where to start, currently referring this link http://blogs.office.com/2013/01/29/10-tips-for-developers-working-with-the-visio-vsdx-file-format/.

I want to code this program in Eclipse using Java but the above link is explained totally using C# in Visual Studio. I didn't get any Java library for Visio 2013. Can someone help me and give some idea how should I create a .vsdx file in Java which will be supported by Visio 2013?

2

There are 2 answers

4
Saqib Razzaq On

Here are the list of Java libraries available for handling Microsoft Visio documents.

  1. Apache POI-HDGF. It is open source. Reliable and widely used/developed by community.
  2. Aspose.Diagram for Java, but it is a commercial library. Only supports reading vsdx at the moment.

If anyone knows of any other library, please update the answer.

0
n8n8baby On

There are some complications you should be aware of:

  1. Visio 2013 file format is specified in an XSD 1.1 schema. This version of XSD is not usable by JAXB, which means you will have to do a lot of manual work to get the data to resolve to Java objects.
  2. Aspose.Diagram has quite a few gaps in its functionality based on the brief evaluation I did on it a few weeks ago.
  3. The OpenXML4J stuff works fairly well for manipulating the OPC container, but there are a couple of conficts when using JAXB together with this (namely, the relationships within the XML documents themselves are not scooped and must be read in a second, straight DOM, pass).

My approach has been to hack the XSD Schema back down to a 1.0 version and using the N attributes of the objects to switch by type. When I have completed my work, I will be happy to share the XSD which would be usable by JAXB.