Free Support Forum - aspose.com

Dynamic Table of Contents

I need to do a table of contents in my document that will include page numbers that will vary depending on the content and length of the document. I know that Aspose.Word can do hyperlinks to locations, but I need page numbers as my report is primarily needed for print. I also know that Aspose.Word supports Word’s TOC fields, but it does require the fields in the document to be “updated” manually. This doesn’t work for me as I’m going to be converting to PDF using Aspose.PDF.

I have noticed that Aspose.PDF supports page numbering using some sort of $p indicator in the XML when it sees a { page } field from Aspose.Word. I like the Word { PAGEREF [bookmark name] } feature, but it does not seem to be supported by Aspose.PDF. Is this a possibility?

In any case, my need is to do a dynamic table of contents that will render correctly when my Aspose.Word generated document is converted to PDF using Aspose.PDF. I imagine that this would be tremendously valuable to Aspose.Word users if a solution could be determined.

Any ideas?

Thank you for your request, we’re looking into it. We’ll reply you as fast as possible.

Thanks for looking into this.

I’m currently trying various “outside-of-the-box” solutions to building the table of contents. One thing I just started experimenting with a couple of minutes ago is the Section.PageSetup.PageStartingNumber function. If each item in my Table of Contents is a seperate section, maybe I can get the page number using the PageStartingNumber?

Right now I have 4 sections in my document, but PageStartingNumber=1 on all of them, even though RestartPageNumbering is False.

If I can get the page that each section starts at from inside my VB.NET code, I should be able to dynamically generate the table of contents based on the number of sections and the section start locations.

Is there any promise in this? And why is my PageStartingNumber always 1?

Aspose.Word does not know how the document is split into pages, it is also not possible to do PAGEREF [bookmarkname] in Aspose.Pdf.

It might be possible later when Aspose.Word:

1. Implements field evaluation engine so it can update field results itself.

2. Page rendering engine so it can lay out document into pages.

But this will be several months away.

Please see this http://www.aspose.com/forums/ShowPost.aspx?PostID=15563.

What is the current status of the pagination engine for Aspose.Word? I have a need to generate a TOC with page numbers and I'm not seeing any way to do it with the current version of Aspose.Word.

Thanks,
Jerry

Hi Jerry,

We’re planning to release a preview version of the engine very soon.

I don’t know if you have lists of folks to notify when a feature becomes available, but if you do, put me on the list to notify when the pagination engine is ready to be previewed.

Cheers,
Jerry
jhoward@moondust.com

Hi Jerry,

The engine will become available along with the Aspose.Word v3 that will be released very soon. I’d want to remind you once more that the preview version of the engine supports quite limited features.

I’m having the same problem. I have 3.0 installed how do I use these new features?

I need to have correct page numbers and to be able to remove items from the TOC as I have put them in conditional sections in the doc.

Thanks

Sorry but the current version of the rendering engine is still beta and the pagination mechanism should be refined. Also, we do not provide support for this in the meantime.

Field evaluation engine will be completed in several months.

I suppose since this is not working in the Word component, it’s not working in th PDF output either.

I noticed that the PDFs seem to ignore page breaks as well.

Is there an ETA on these features? Or any kind of a non-manual work around?

As I already said, the implementation may take several months.

Just curious as to the status of this. Is it coming out anytime soon? Currently our web application calls the word object (automation, yes I know… bad bad bad) and then simply do a “UpdateWordFields” then close it in the finally. It’s worked so far, but I’d like to remove this as it introduces some security issues as well.

Our pagination engine is still under development. We will try to launch it this year.

5 months down the line, is there any news on this feature?

The development is almost finished. We are going to release before the end of the year. November-December is our current estimate.

Best regards,