This project has moved and is read-only. For the latest updates, please go here.

Creating Index Entries for your document

Jul 18, 2013 at 3:43 AM
I am contemplating adding functionality to enable adding index entries in my Word document so I can easily construct an Index at the back of the document. Has anyone already done this? I couldn't see it in my searches, but it wouldn't be the first time I missed something.

This looks relatively straight forward. I suspect I create a helper method to construct the XML Nodes that an Index Entry requires, do something with RenumberIDs and then create an external method to call that wraps this.

Judging by the XML file I expect to be creating something like the following with the ID, MajorText and MinorIndexText populated with my arguments from the below. For these I stripped out the XML Nodes that appeared to be defining formatting things as I expect I can do without them.
-<w:r w:rsidR="00C1598D"><w:fldChar w:fldCharType="begin"/></w:r>
-<w:r w:rsidR="00C1598D"><w:instrText xml:space="preserve"> XE "</w:instrText></w:r>
-<w:r w:rsidR="00C1598D" w:rsidRPr="ID"><w:rPr><w:instrText>MAJOR TEXT:</w:instrText></w:r>
-<w:r w:rsidR="00C1598D" w:rsidRPr="ID"><w:instrText>MINOR INDEX TEXT</w:instrText></w:r>
-<w:r w:rsidR="00C1598D"><w:instrText xml:space="preserve">" </w:instrText></w:r>
-<w:r w:rsidR="00C1598D"><w:rPr><w:fldChar w:fldCharType="end"/></w:r>
Is this potentially a lot more complex than I am expecting?? Any suggestions to make this easier?