how to read numbered sections info from a docx file

Posted:
Tue Sep 06, 2011 7:16 am
by shikida
Hi
I have a document with a table of contents
1. x
1.1. xxx
2. y
2.1. yyyy
and so on
how do I extract these elements?
TIA
Kenji
Re: how to read numbered sections info from a docx file

Posted:
Tue Sep 06, 2011 10:18 am
by jason
Do you want to read the contents of the TOC field itself, or do you want to visit the numbered headings themselves?
If the latter, you could simply iterate through the paragraphs looking for those with relevant style and numPr. Start by unzipping your docx, and looking at its document.xml in a text editor.
Note that "section" has a different meaning in WordML.