How to modify an OpenOffice.org Draw diagram in Java?
I have a开发者_Python百科n OpenOffice.org Draw diagram, which shows individual modules of my software.
I also have a file with information about problems in those modules (each module can be in one of 3 states: OK, ERROR, UNKNOWN).
I want to
a) color the figures in the diagram according to the information from the file (problematic modules - red, OK modules - green and all others - gray) and b) export the diagram to an image file.
The original diagram is created manually (so that it is laid out nicely).
Question: How can I do this, preferably in Java?
Thanks in advance
Dmitri
OpenOffice has an official API. You should check if it can do what you need.
If not, a reasonable way to progress would be to export to SVG, and then use a SVG library to manipulate the SVG XML as needed.
@TRA has a good point. On the other hand, if you're feeling brave..
Open Office files are Zipped XML. Use a ZipInputStream
to get access to the entries, then any of the plethora of J2SE based XML handling APIs (Sax, DOM etc.) to parse the XML.
精彩评论