Page 1 of 1

Open a SmartArt

PostPosted: Wed May 30, 2012 1:02 am
by bzanotti
Good Morning.

I'm new in docx4j.
I w'd like to know, how i open a docx that contains a smartArt.

I've tryed:
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File("...."));

So what i have to do next ?
How can i open and acess the hierarchy texts ?

Thanks...

Re: Open a SmartArt

PostPosted: Wed May 30, 2012 12:16 pm
by jason
Start by running the docx through the PartsList sample; and see Getting Started as to how to access the relevant parts.

Re: Open a SmartArt

PostPosted: Thu May 31, 2012 7:06 am
by bzanotti
Humm..ok.
There is a especific document that i should start ?

Does exists a tutorial that show how i do this ?

Thanks..

Re: Open a SmartArt

PostPosted: Thu May 31, 2012 8:46 am
by jason
See the Getting Started document at http://www.docx4java.org/docx4j/ in HTML, PDF or DOCX format.

Re: Open a SmartArt

PostPosted: Fri Jun 01, 2012 12:02 am
by bzanotti
Thanks.

Question: It's correct this code ?

OpcPackage opcPackage = OpcPackage.load(new java.io.File(inputfilepath));
DiagramLayoutPart source = null;
DiagramDataPart sourceData = null;
for (Entry<PartName,Part> entry : opcPackage.getParts().getParts().entrySet() ) {
if (entry.getValue().getContentType().equals(ContentTypes.DRAWINGML_DIAGRAM_LAYOUT )) {
source = (DiagramLayoutPart)entry.getValue();
}
if (entry.getValue().getContentType().equals(ContentTypes. DRAWINGML_DIAGRAM_DATA)) {
sourceData = (DiagramDataPart) entry.getValue();
}
}

This DiagramLayoutPart or DiagramDataPart contains the properties of SmartArt ?

Re: Open a SmartArt

PostPosted: Fri Jun 01, 2012 3:42 pm
by jason
to look at the contents of a JAXBXmlPart p, try something like:

Code: Select all
System.out.println(XmlUtils.marshaltoString(p.getJaxbElement(), true, true));