Hi,
First: I'm not looking for a table of content. Not like the one Word offers at least.
My document format looks some kind like this: underlined text is the "name" of the chapter, you might say, and is the actual text I want to populate a table with.
Heading 1: Unique name (actually in number format).
Heading 2: The actual name (underline) contain the text I want.
Heading 3: Actual data. in a number list
Heading 1 Experiment #1Heading 2 Critical
Heading 3 Item 1.1
Heading 3 Item 1.2
Heading 2 Deviations
Heading 3 Item 2.1
Heading 3 Item 2.2
Heading 2 Remark
Heading 3 Item 3.1
Heading 3 Item 3.2
From this, I want a table (with dynamic length, based on number of heading 1's).
Note that Experiement #2 dont have any ciritcal items in this example.
Experiment |
type |
Text |
Experiment #1 |
Critical
|
Item 1.1
Item 1.2 |
|
Deviations
|
Item 2.1
Item 2.2 |
|
Remark
|
Item 3.1
Item 3.2 |
Experiment #2 |
Deviations
|
Item 2.1
Item 2.2 |
|
Remark |
Item 3.1
Item 3.2 |
Appreciate any help anyone can provide some helpfull insight, even better if anyone has code for this.
I want to create a table, to make a summary
The psudo code, in my head
H1_Count = ThisDocument.Heading1.Count()
iCol = 3; // 3 columns
iRow = H1_Count +1 // Heading 1 count + header
Table = CreateTable(iCol, iRow)
row = Table.AddRow()
row(0,"Experiment")
row(1,"Type")
row(2,"Text")
foreach H1 in ThisDocument:
row = Table.AddRow()
row(0,H1.Text) // first column filled with experiment #
foreach H2 in ThisDocument:
row(1,H2.Text) // second column filled with Critical/Deviation/Remarks
foreach H3 in ThisDocument:
row(2,H3.Text) // third column filled with all items