My app creates a new Word document(docx) with the use of a template (docm).
The template has a table of contents like this:
Table of Contents
1 Customizing Settings in IMG…7
A Other applicable documents…8
List of Abbreviations…9
References…10
Change History / Release Notes…11
Distribution List…12
Authorization…12
My app inserts into the new document some header with content. The headers looks like this
1.1 Customizing this and that
1.1.1 Customizing Activities
1.1.1.1 Usage
1.1.1.2 Prerequisites
1.1.1.3 Database Entities
And this hierarchy is repeated for many entries.
Now I want to update the table of contents.
With
oWord.ActiveDocument.TablesOfContents.add(oWord.ActiveDocument.Range(0,0),true,1,9,false,nil,true,true,nil,true,true,false)
I get the same as the template already has.
With
oWord.ActiveDocument.TablesOfContents(1).Update
I get only lower header lines like this
Table of Contents
1.1.1 Customizing Activities due to Customizing Object [Warehouse Process Type]…7
1.2.1 Customizing Activities due to Customizing Object [Warehouse Process Type - Description] …7
1.3.1 Customizing Activities due to Customizing Object [Storage Process - Definition]…8
1.4.1 Customizing Activities due to Customizing Object [Storage Process - Description]…9
1.5.1 Customizing Activities due to Customizing Object [Determination of Warehouse Process Type]…9
Has anybody an idea how I get the complete list of headings into the table of contents?