10 Answers, 1 is accepted
0
Hello Axelle,
You can insert a TableOfContents field using the following code snippet:
Hope this answers your question.
Regards,
Kammen
Telerik
You can insert a TableOfContents field using the following code snippet:
RadDocument document =
new
RadDocument();
RadDocumentEditor editor =
new
RadDocumentEditor(
new
RadDocument());
editor.InsertField(
new
TableOfContentsField(), FieldDisplayMode.Result);
Hope this answers your question.
Regards,
Kammen
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Axelle
Top achievements
Rank 1
answered on 13 Jun 2014, 02:36 PM
That almost works. However I get : No table of contents entries found.
My guess is that it is because I use custom headers. Is there a way to specify which lists are used as table of contents entries ?
My guess is that it is because I use custom headers. Is there a way to specify which lists are used as table of contents entries ?
0
Hello Axelle,
Indeed, TOC is generated based on the paragraphs with Heading styles applied. The only way to ensure that a custom style is used in the generation of the field is to base the style on one of the headings, for example:
You also need to set the UseParagraphsOutlineLevels property of the field to true.
I hope this is useful.
Regards,
Petya
Telerik
Indeed, TOC is generated based on the paragraphs with Heading styles applied. The only way to ensure that a custom style is used in the generation of the field is to base the style on one of the headings, for example:
StyleDefinition paragraphStyle =
new
StyleDefinition();
paragraphStyle.Type = StyleType.Paragraph;
paragraphStyle.BasedOn =
this
.radRichTextBox.Document.StyleRepository[RadDocumentDefaultStyles.GetHeadingStyleNameByIndex(1)];
paragraphStyle.ParagraphProperties.Background = Colors.Red;
paragraphStyle.DisplayName =
"myStyle"
;
paragraphStyle.Name =
"myStyle"
;
this
.radRichTextBox.Document.StyleRepository.Add(paragraphStyle);
You also need to set the UseParagraphsOutlineLevels property of the field to true.
editor.InsertField(
new
TableOfContentsField() { UseParagraphsOutlineLevels =
true
}, FieldDisplayMode.Result);
I hope this is useful.
Regards,
Petya
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Axelle
Top achievements
Rank 1
answered on 23 Jun 2014, 08:41 AM
No, I still get the same error (No table of content entries found).
Is there any way to debug that ? (Or to access the various titles and their page from the document eidtor, then I can build my ToC myself).
Is there any way to debug that ? (Or to access the various titles and their page from the document eidtor, then I can build my ToC myself).
0
Axelle
Top achievements
Rank 1
answered on 23 Jun 2014, 09:53 AM
Hi, I succesfully generated the table of contents, but I know have two issues :
- The paragraph title do not contain their numbering in the table of contents
- The page numbers are not correct (everything appears on page 1). This might be because the document is a compound of other documents.
- The paragraph title do not contain their numbering in the table of contents
- The page numbers are not correct (everything appears on page 1). This might be because the document is a compound of other documents.
0
Axelle
Top achievements
Rank 1
answered on 23 Jun 2014, 09:58 AM
(If that plays a role, please note that the document is generated from code, and not displayed in a radrichtextbox).
0
Axelle
Top achievements
Rank 1
answered on 23 Jun 2014, 11:06 AM
After a few tests, the behaviour is the same if displayed in a textBox : the table of contents is ok, but the page numbers don't seem to be computed.
0
Hi Axelle,
It seems that there is a bug with the TableOfContent field. I will add it to our back log but I cannot give you any time frame when this will be fixed.
The Telerik points are updated in your account in appreciation of your involvement.
Regards,
Kammen
Telerik
It seems that there is a bug with the TableOfContent field. I will add it to our back log but I cannot give you any time frame when this will be fixed.
The Telerik points are updated in your account in appreciation of your involvement.
Regards,
Kammen
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Steve
Top achievements
Rank 1
answered on 18 Dec 2015, 05:04 PM
Is there an update to this?
All of the number of the TOC contents are on Page 1.
I can Shift+Tab to get them to move to the next page but they default back to page 1 again the next time the document is opened.
All of the number of the TOC contents are on Page 1.
I can Shift+Tab to get them to move to the next page but they default back to page 1 again the next time the document is opened.
0
Hello Steve,
The issue originally reported in this ticket was fixed in 2015 Q2 release (here listed as "When UpdateAllFields is called all PageReferenceFields and PageFields are updated to 1."). Could you specify your exact version, steps to reproduce the problem and the expected result? If the problem is different, I would encourage you to open separate support ticket dedicated to it.
Regards,
Boby
Telerik
The issue originally reported in this ticket was fixed in 2015 Q2 release (here listed as "When UpdateAllFields is called all PageReferenceFields and PageFields are updated to 1."). Could you specify your exact version, steps to reproduce the problem and the expected result? If the problem is different, I would encourage you to open separate support ticket dedicated to it.
Regards,
Boby
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items