Page 1 of 1

text and paragraph properties of the paragraph

PostPosted: Fri Jul 01, 2011 10:16 am
by naked11
Hello,
is any way, how i can get paragraphs of existing document and then for each paragraph get text and paragraph properties (rPr and pPr)?

Are there mothods in docx4j? I was searching, but with no reason.
Thank for your help.

Re: text and paragraph properties of the paragraph

PostPosted: Fri Jul 01, 2011 12:05 pm
by tinne
Yes, sure, like any other element conforming to the transitional Schema, they can be found. Given you got a org.docx4j.wml.P element containing your paragraph, tell it to getContent(), and search the result list for an object implementing org.docx4j.wml.PPr, the same for R/RPr respectively.

Just think of the JAXB representation of a OpenXML document part as a DOM tree turned into typed objects.

Re: text and paragraph properties of the paragraph

PostPosted: Fri Jul 01, 2011 5:50 pm
by naked11
Could you write code of example, pls?

Re: text and paragraph properties of the paragraph

PostPosted: Sun Jul 03, 2011 2:46 pm
by jason
Have you looked at the Getting Started guide?

It describes in more detail what you are trying to do.

Also, see the sample programs eg OpenMainDocumentAndTraverse. Other parts of the docx4j source code will also be instructive.