We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Table of Contents?

I've generated a large document and I would like to enable the user to generate a table of contents. I have created three styles (different fonts etc.) which represent the three levels that I'd like to show up in the table of contents.

It looks fine, but the issue is that Word's table of contents utilty doesn't pick them up. If I go to the toolbar, I notice that their "Level" is set to "Body Text." I set the styles to "Level 1", "Level 2" and "Level 3" they get added to the table of contents.

How do I set their level from DOCIO? In addition, I'd like to programatically create a table of contents so that the user doesn't have to do it manually. Is that possible? On thought was to create one in a Word template and clone it but that didn't seem to work.

Thanks in advance.
know that I want to treat them that way.

(1)How do I set

6 Replies

DK Dhivya K Syncfusion Team December 4, 2006 01:46 PM UTC

Hi Scott,

I am not sure if I have understood your requirements correctly. Are you setting styles for the TableOfContents manually and it is not preserved with DocIO? If this is tha case,this feature of preserving Table of contents is implemented internally which is not included in 4.4. However, I can provide you with preview version, if you can create Direct trac incident.
Also,Currently we have support only for Table of contents preservation. However, we do not have support for creating Table of contents programatically. I will consult with development team regarding this feature and send you an update as soon as I hear back.
Sorry for the inconvenience.
Please let me know if you have any other queries.

Regards,
Dhivya.


SS Scott Swartz December 5, 2006 02:21 AM UTC

At this point I am creating the entire document programatically. I programatically create three styles(i.e., MyHeading_1, MyHeading_2 and MyHeading_3) each of which has a different font size. The issue is that in Word their "level" is body text so when I manually try to add a table of contents those headings are not picked up.

(1) My first question is can I programatically set the "level" or whatever it's called so that the user can manually create a table of contents.

(2) If the answer to #1 above is yes, I would like to know if I can programatically create a table of contents or clone a template so that the user has no manual steps.

(3) If (1) above doesn't work (i.e., I can't set the "level" for a programatically created style)is their a work around. For example, should I create a template the includes the three styles, clone it and then apply that style to the headings that I'm generating.


DK Dhivya K Syncfusion Team December 6, 2006 01:22 PM UTC

Hi Scott,

Sorry for the delay in getting back to you.

I was able to reproduce the issue. Currently we do not have support for creating Table of contents programatically. We can only preserve existing Table of contents. The styles that we set in our code using DocIO is not picked up by Word as Outline levels.
I will consult with development team regarding this feature and send you an update within a day.

Regards,
Dhivya.


DK Dhivya K Syncfusion Team December 12, 2006 09:53 AM UTC

Hi Scott,

Sorry for the delay in getting back to you. Currently we do not have support for creating TOC by any way. We can only preserve the TOC if it is created manually. I have filed a feature request regarding this feature with development team.
You can keep track of the status of this feature from the following link.
http://www.syncfusion.com/support/features/docio/Default.aspx?ToDo=view&questId=1395
Sorry for the inconvenience.

Please let me know if you have any queries.

Regards,
Dhivya.


BD Benoit Drapeau March 21, 2008 12:57 AM UTC

Hi, can you please tell me the status of this incident? Is it implemented in the version 6.1.0.* and if so I do we use it. I'm currently creating custom styles that I do want to be shown in (1) a table of contents and also in (2) the document explorer view of Word. If I look at the paragraph properties of the generated document, I notice that the "Level" is set to "Body Text". Can I change that property programmatically?.

Thanks in advance

Benoit Drapeau

>Hi Scott,

Sorry for the delay in getting back to you. Currently we do not have support for creating TOC by any way. We can only preserve the TOC if it is created manually. I have filed a feature request regarding this feature with development team.
You can keep track of the status of this feature from the following link.
http://www.syncfusion.com/support/features/docio/Default.aspx?ToDo=view&questId=1395
Sorry
for the inconvenience.

Please let me know if you have any queries.

Regards,
Dhivya.



AD Administrator Syncfusion Team March 25, 2008 10:02 AM UTC

Hi Benoit,

Thanks for the update.

1. Table of content
Yes, we have implemented this feature in our latest source not in the version 6.1. This feature will be available in our version 6.2 which is going to be released by next month.

Custom style support

Yes, it is possible to set the custom style to the paragraph. Please refer the below code snippet for built in styles, custom styles and custom style for TOC.

//Built in Styles
para.ApplyStyle(BuiltinStyle.Toc3); // This is not in version 6.1. This is in the version 6.2
para.AppendText("Table of Contents");
//Custom styles.
WParagraphStyle pStyle1 = (WParagraphStyle)document.AddParagraphStyle("MyStyle1")
para.ApplyStyle(pStyle1 )
//Custom Style fot TOC
TableOfContent toc = para.AppendTOC(1, 3);
toc.SetTOCLevelStyle(1, "MyStyle1");

Here is the sample for your reference:
http://websamples.syncfusion.com/samples/PDF.Windows/I40279_1/main.htm

Please let me know if you have any other questions.

Best Regards,
Bhuvana



Loader.
Live Chat Icon For mobile
Up arrow icon