Page 1 of 1

Relationship between document.xml and styles.xml

PostPosted: Fri Apr 21, 2017 4:31 pm
by thirub04
Hi Jason,

How do we find the style of a paragraph, for instance if it is
a) Heading 1
b) Heading 2 and so on
c) TOC Heading


Or do we have any relationship between document.xml and styles.xml ?

Re: Relationship between document.xml and styles.xml

PostPosted: Fri Apr 21, 2017 10:30 pm
by jason
The style a paragraph uses is represented as follows:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
    <w:p">
      <w:pPr>
        <w:pStyle w:val="Heading1"/>
      </w:pPr>
 
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


for P p, use p.getPPr().getPStyle()

If there is no pStyle element, the paragraph uses the default paragraph style.

The style itself is defined in the style definitions part (styles.xml).

The style definitions part is a rel of the Main Document Part (document.xml); you can get the Styles part from your MainDocumentPart object.

Re: Relationship between document.xml and styles.xml

PostPosted: Sun Apr 23, 2017 6:37 pm
by thirub04
Hi Jason,

Correct me if I am wrong, I have found all these styles (Heading1, Heading2,. etc, TOC, TOC Heading) in styles.xml. I am not getting them from the pStyle element. Rather from the styleid of Style element.

I have to iterate the contents of the document, specifically the paragraphs and find their styles.

I am not able to do it.

Re: Relationship between document.xml and styles.xml

PostPosted: Mon Apr 24, 2017 3:31 pm
by jason

Re: Relationship between document.xml and styles.xml

PostPosted: Mon Apr 24, 2017 6:03 pm
by thirub04
Hi Jason,

This does not satisfy my requirement.

I have to find if the paragraph is a heading 1, heading 2, heading 3 TOC.

Re: Relationship between document.xml and styles.xml

PostPosted: Mon Apr 24, 2017 10:33 pm
by jason
I can't help you unless/until you take the time to understand what I have written in this thread already.

Re: Relationship between document.xml and styles.xml

PostPosted: Thu Apr 27, 2017 11:19 pm
by thirub04
Hi Jason,

I have understood things now. Thanks for your reply and support .