Table of contents in word document

Hi Roman,

I have succesfully imported a word document with a TOC now.
Next thing to do for me is finding a way on how to add my TOC fields to the document. The purpose of this is to make a nice reports.

best regards,

ioan

If only my client wanted pdf

This is interesting. All I need to do is allow adding bookmarks and fields to the document using DocumentBuilder. This is something we wanted to do anyway so maybe we can bring this work forward. I will keep you posted.

Hi ioan,

Aspose.Word 1.5.2 is available with new DocumentBuilder.InsertTableOfContents method. Check out if this solves your problems.

Hi Roman,

Thanks for your effort ! I tested the insertableofcontents method. and it works fine. But for my situation it’s not much use. I load a word document with an existing TOC, and add many chapters of text. Each chapter has many paragraph styles, of which the headings are collected by the TOC. I can do this now in an awkward matter with many predifined fields. But it would be so much nicer if I were able to add a text with stylenames … from code
But I haven’t found a way to use existing styles from code.

Best Regards,

ioan Klaassen

Hi ioan,

No worries, we were going to allow specifying styles using DocumentBuilder too. It will be something like DocumentBuilder.ParagraphFormat.Style = “MyStyle”.

Do you need to be able to create styles programmatically? This can also be done, but we probably want to do this later.

Hi Roman,

This is great I will only use the styles from the template documents. And of those the most important ones are “normal” and “heading1”, “heading2”. The headings are then collected by Word to make a nice TOC.

Best regards,

ioan klaassen

DocumentBuilder.ParagraphFormat.StyleName property is available in Aspose.Word 1.5.4.

Here is a code example:

builder.InsertParagraph();
builder.ParagraphFormat.StyleName = "Heading 1";
builder.Writeln("Heading 1");

Hi Roman,

I tested the new styles property. and it works like a charm Now I can fully comply with my clients wishes. And do it faster and easier than any other method for making Word files.
If my project proposal is agreed upon, we will choose your components.

best regards,

ioan

Hi,

I want to create the TOC programatically in word document using ASP.NET. Can someone has any info on this. Is any of the ASPOSE component support this.

Sure, it can be done using Aspose.Words. Please check the following documentation article:
https://docs.aspose.com/words/net/working-with-table-of-contents/

I got to generate pocket booklet with (Table of Content)TOC . booklet layout will be 8 pages per A4 size paper.
Aspose Reporting Serivces support this feature ? If so, we are willingly to buy the product .

Hi,

If you need to generate the document from an RDL report, then this product is right what you need. To insert a TOC, specify “TOC” as the textbox ToolTip property value. Note this feature is undocumented.

Thanks.

Thanks you very much for reply .

I want to generate Word Document from RDL .
I tested text box Tooltip as TOC .
I might miss out steps to follow.
Knowing that this feature is undocumented, could you please give me instruction steps to follow?

  1. Style need to be “header1” ?If so, how to ?
  2. need bookmark ?

currently if , I apply Tooltip as TOC . textbox.value can’t even visible at word doc.

Oops, I indeed forgot to mention that you have to specify the style for TOC entries as well. For the texboxes supposed to become TOC entries, set ToolTip to STYLE=“headingN” wher N is a number.

Let me know if it works.

Thank you.

TOC area is not showing .
TOC entries Style seems ok . HeadingN can apply .

For textbox’s tooltip= TOC is only one blank text box ?

Try putting some text as its value. The text will be ignored and a TOC should be inserted instead.

Thanks you . It work.
Table of Content section count page number ?
Is zit possible Page number start after TOC section ?

I’m not sure I understood the question. It seems like you need to update the TOC field after opening the document by pressing Ctrl-A and then F9. Then it should update page numbers being referred.

my question is
eg. table of content occupy first 2 pages , the content data start form 3rd page.

page number of Table of content eg, page i and page ii .

page number of content data, can it be start form page 1 ?