Hello,
Is there any easy way (without coding it manually) to get a numbering in the talbe of contents?
It should look like this:
Table of Contents
A. Headline1...................................................1
A.1. Headline1Sub1.........................................1
A.2. Headline1Sub2.........................................2
B. Headline2
C. Headline3
C.1. Headline3 Sub1
C.2. Headline3 Sub2
C.3. Headline3 Sub3
< Some Text >
A. Headline1
< Some Text >
A.1. Headline1 Sub1
< Some Text >
A.2. Headline1 Sub2
< Some Text >
B. Headline2
< Some Text >
......
The Code I'm using now looks like this:
TParagraph *Par; TWPRTFNumberingStyle *MyNumberStyles[3]; MyNumberStyles[0] = wp_Document->NumberStyles()->AddOutlineStyle(1,1); MyNumberStyles[0]->Style = wp_lg_a; MyNumberStyles[0]->TextA = "."; MyNumberStyles[0]->TextB = ""; MyNumberStyles[0]->Font = ""; MyNumberStyles[0]->Indent = 360; MyNumberStyles[0]->UsePrev = true; MyNumberStyles[1] = wp_Document->NumberStyles()->AddOutlineStyle(1,2); MyNumberStyles[1]->Style = wp_1; MyNumberStyles[1]->TextA = "."; MyNumberStyles[1]->TextB = ""; MyNumberStyles[1]->Font = ""; MyNumberStyles[1]->Indent = 720; MyNumberStyles[1]->UsePrev = true; MyNumberStyles[2] = wp_Document->NumberStyles()->AddOutlineStyle(1,3); MyNumberStyles[2]->Style = wp_1; MyNumberStyles[2]->TextA = "."; MyNumberStyles[2]->TextB = ""; MyNumberStyles[2]->Font = ""; MyNumberStyles[2]->Indent = 1080; MyNumberStyles[2]->UsePrev = true; Par = wp_Document->FirstPar; wp_Document->InputMergeField( WPTOC_FIELDNAME,"Toc created here...","",0,' '); Par = wp_Document->InsertPar(); Par->Append("History"); Par->ASet(WPAT_NumberSTYLE,MyNumberStyles[0]->ID); Par->ASet(WPAT_NumberLEVEL,1); Par->ASetCharStyle(true,WPSTY_BOLD); Par->ASet(WPAT_ParIsOutline,1); wp_Document->InsertPar(); dbrt_Buffer->DataField = "HISTORY"; wp_Document->FastAppendText(dbrt_Buffer,false); Par = wp_Document->InsertPar(); Par->Append("Deviations"); Par->ASet(WPAT_NumberSTYLE,MyNumberStyles[1]->ID); Par->ASet(WPAT_NumberLEVEL,2); Par->ASet(WPAT_ParIsOutline,1); wp_Document->InsertPar(); dbrt_Buffer->DataField = "DEVIATIONS"; wp_Document->FastAppendText(dbrt_Buffer,false); Par = wp_Document->InsertPar(); Par->Append("Test"); Par->ASet(WPAT_ParIsOutline,1); Par->ASet(WPAT_NumberSTYLE,MyNumberStyles[2]->ID); Par->ASet(WPAT_NumberLEVEL,3); wp_Document->InsertPar(); dbrt_Buffer->DataField = "DEVIATIONS"; wp_Document->FastAppendText(dbrt_Buffer,false); wp_Document->DelayedReformat();
This sets up the document and marks the headlines as ParIsOutline
To build up the TOC I use following code:
TWPCreateTableOfContentsMode MyMode;
MyMode = MyMode << wptocUseParIsOutline << wptocCreateOutlineBookmarks << wptocCreateHyperlinks << wptocCreateHyperlinkNumbers;
wp_Document->CreateTableOfContents("Table of Contents","Toc_",MyMode,NULL,"TABLE OF CONTENTS",NULL);
wp_Document->DelayedReformat();
Works fine for building a ToC, but I dont see any numbering in ToC :( I tried different ways to get it, but I haven't found any way to get this running.
At the moment it looks like:
Table of Contents
Headline1...................................................1
Headline1Sub1.........................................1
Headline1Sub2.........................................2
Headline2
Headline3
Headline3 Sub1
Headline3 Sub2
Headline3 Sub3
< Some Text >
A. Headline1
< Some Text >
A.1. Headline1 Sub1
< Some Text >
A.2. Headline1 Sub2
< Some Text >
B. Headline2
< Some Text >
......
For our purposes it would be enough to use the complete text of the numbered paragraph as headline (the numbering doesn't need to be directly linked to the ToC as it is in Word)
At the moment he just uses "Headline2" as text for ToC. Can I tell him to use "B. Headline2"? Tried different ways, but it just won't work :(
But if there's a way to easily link the numbering with the ToC that would be even better :)
Would be really great if you could help!
Thanks in advance,
Florian Fanderl