Free Support Forum - aspose.com

Incorrect page numbers in the TOC

I'm having problems with the TOC in documents created using Aspose.Words that contain a combination of Reporting Services reports (exported to Word format), other stand alone Word documents, and text headings. After calling the UpdateFields() method and saving the resulting document, the TOC contains incorrect page numbers e.g. content on page 10 is shown to be on page 11, etc. Strangely, ctrl+clicking links in the TOC takes me to the correct page. Updating the field in Word (either using the 'Update page numbers only' or the 'Update entire table' options) corrects the numbers however, as you can imagine, this isn't a workable solution.

To insert TOC I'm using the following code:

docBuilder.InsertTableOfContents("\\o \"1-6\" \\h \\z \\u");

To append document contents I do the following:

foreach (Section section in docToBeAdded.Sections)

{

docBuilder.CurrentSection.AppendContent(section);

}

To add headings:

docBuilder.CurrentParagraph.ParagraphFormat.StyleName = "Heading 1";

docBuilder.WriteLn("Some heading text");

Finally, to update the TOC:

doc.UpdatePageLayout();

doc.UpdateFields();

I am desperate for some assistance with this as I'm running out of ideas for a fix.

Hi, I thought it might be a good idea to give you an example document so that you can reproduce the problem at your end. The first document called TOCTest1.doc contains an empty TOC that I update using the UpdateFields() method. The result is TOCTest2.doc and has incorrect page numbers in the TOC e.g. ElectorateStaff is shown to be on page 5 but is in fact on page 4. I am using version 10.7.0.0 of Aspose.Words for .NET. Please, look into it as soon as possible as I need a fix very urgently.

M.

Hi Mariusz,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 11.3.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system as WORDSNET-6337. Your request has also been linked to this issue and you will be notified as soon as it is resolved.

Sorry for the inconvenience.

Best Regards,

It's been a couple of weeks, any progress? ETA? Workaround?

Hi
Mariusz,


Thanks for your inquiry. Unfortunately, your issue is not resolved yet. Currently, this issue is pending for analysis and is in the queue. Rest assured, we will inform you via this forum thread as soon as it’s resolved. Sorry for the inconvenience.

Best Regards,

I am also facing same issue in our product where we are using Aspose to publish documents. The TOC page number are off but clicking on the page number will take you to correct page. I am using the latest (Aspose Total for Java) version if that matters.


I have also opened another ticket for this issue
<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:“Times New Roman”;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA”>http://www.aspose.com/community/forums/thread/390074.aspx

The sooner you guys fix it the better it is for me as I have a release schedule for end of this month.

I figured I update this thread as well since you guys are using the same code base to build both .net and java :-).

Thanks a lot,
Telos

Hi Telos,


Thanks for the additional information. I have already answered, here in this post, to a similar query of yours. Please follow this thread for further proceedings from now onwards.

Best Regards,

I get “Access Denied” error when I click on the links you’ve supplied.

Hi Mariusz,


Thanks for your inquiry. I think, in your case, there is no useful information in there. As that is a private thread, you can not access it. Moreover, I have verified the status of your issue (WORDSNET-6337) from our issue tracking system and regret to share that this issue is still unresolved. Currently, it is pending for analysis and is is the queue. We will inform you as soon as it’s resolved.

Best Regards,

Hi Mariusz,

I have ran into another issue with UpdateToc where it is failing with NullPointer Exception in Java. Below is a stack trace from my run.

java.lang.NullPointerException
at com.aspose.words.ade.a(Unknown Source)
at com.aspose.words.ov.Re(Unknown Source)
at com.aspose.words.Field.b(Unknown Source)
at com.aspose.words.Field.a(Unknown Source)
at com.aspose.words.pv.a(Unknown Source)
at com.aspose.words.Field.jo(Unknown Source)
at com.aspose.words.Field.b(Unknown Source)
at com.aspose.words.Field.a(Unknown Source)
at com.aspose.words.pv.a(Unknown Source)
at com.aspose.words.pv.j(Unknown Source)
at com.aspose.words.ps.execute(Unknown Source)
at com.aspose.words.pv.jF(Unknown Source)
at com.aspose.words.pv.updateFields(Unknown Source)
at com.aspose.words.Range.updateFields(Unknown Source)
at com.aspose.words.Document.updateFields(Unknown Source)
at com.xacta.webca.pub.flexpublisher.parser.word.WordParser.updateTOC(WordParser.java:298)
at com.xacta.webca.pub.flexpublisher.operations.MainTemplate.save(MainTemplate.java:179)
at com.xacta.webca.pub.PublisherRequest$PublishingThread$2.body(PublisherRequest.java:563)


Thanks,
Telos

Join the queue, I've been waiting to get my problem fixed for weeks and weeks.

If you've stumbled upon this whilst considering the purchase of this product, don't buy it! The support is ridiculously sloooooooow.

Hi Mariusz, Telos,

I am sorry to hear about the troubles you have encountered in forums so far. It is unfortunate that your issues have not yet been fixed. We apologise for the inconvenience.

Normally, when an issue is reported by a customer, it is added to the pool of current issues being worked on by our developers. The issue is then analysed in a timely manner. However, due to the nature of some bugs and the number of features we are working on, this doesn't always mean we can fix every bug within a short time after it's reported.

In your case, the good news is that the responsible developers have already completed the analysis of your issues. The root causes of the problems (WORDSNET-6337 & WORDSNET-6554) have been identified. Also, I have asked the development team to implement the fixes as soon as possible. Rest assured, we will keep you informed of any developments.

We apologise once again for the wait.

P.S: Although we try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue. Our developers work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

That being said, we fully understand that you are keen to get a fix to your particular issue, please have a look at this page - http://www.aspose.com/corporate/services/priority-support-policies.aspx - purchasing Priority Support will allow you to post your issues in our Priority Support forum and raise the priority of these issues directly with our development teams, if possible, we will then aim to get a resolution to your issue as soon as we can. Many Priority Support customers find that this leads to their issue being fixed in the next release of the software.

If you would like to take advantage of Priority Support then please request a quote in our purchase forum - http://www.aspose.com/community/forums/aspose.purchase/220/showforum.aspx - Prices start from $399 for a full year, but we price part year subscriptions based on how long you have left in your current product subscription.

Best Regards,

Hi Telos,


Thanks for your inquiry.
Telos:
I have ran into another issue with UpdateToc where it is failing with NullPointer Exception in Java. Below is a stack trace from my run.

java.lang.NullPointerException
at com.aspose.words.ade.a(Unknown Source)
at com.aspose.words.ov.Re(Unknown Source)
at com.aspose.words.Field.b(Unknown Source)
at com.aspose.words.Field.a(Unknown Source)
at com.aspose.words.pv.a(Unknown Source)
at com.aspose.words.Field.jo(Unknown Source)
at com.aspose.words.Field.b(Unknown Source)
at com.aspose.words.Field.a(Unknown Source)
at com.aspose.words.pv.a(Unknown Source)
at com.aspose.words.pv.j(Unknown Source)
at com.aspose.words.ps.execute(Unknown Source)
at com.aspose.words.pv.jF(Unknown Source)
at com.aspose.words.pv.updateFields(Unknown Source)
at com.aspose.words.Range.updateFields(Unknown Source)
at com.aspose.words.Document.updateFields(Unknown Source)
at com.xacta.webca.pub.flexpublisher.parser.word.WordParser.updateTOC(WordParser.java:298)
at com.xacta.webca.pub.flexpublisher.operations.MainTemplate.save(MainTemplate.java:179)
at com.xacta.webca.pub.PublisherRequest$PublishingThread$2.body(PublisherRequest.java:563)
Unfortunately, it is difficult to say what the problem is without the document and code. Could you please attach your Word document and complete code here to be able to reproduce the same exception on my side. I will investigate the issue on my side and provide you more information.

Best Regards,
Hi Mariusz,

Thanks for your patience. I have received response from our development team on your problem i.e. they're expecting to include the fix of your issue (WORDSNET-6337) in Aspose.Words (v 11.7.0); however, this estimate is not final at the moment. We'll let you know as soon as we make some progress or resolve the issue completely. We're sorry for the inconvenience.

Best Regards,

Thank you for this update, it is good news indeed. When do you expect v11.7.0 to be released?

Hi
Mariusz,


Thanks for your inquiry. Please note that new versions of Aspose.Words for .NET come out at the end of every month. Aspose.Words v11.7.0 is planned to be released by the end of August’ 2012. We will inform you as soon as your issue is resolved.

Best Regards,
Hi Mariusz,

I'm very sorry to share with you that on further investigation we came to know that this issue was more complex than we initially estimated. I'm afraid the issue (WORDSNET-6337), you have reported here, has now been postponed till a later date. We will inform you as soon as there are any further developments. We apologise for the inconvenience.

Best Regards,

Hi Mariusz,


I would like to join the apologies and add a quick note. The problem was analyzed by our layout team and they confirmed the cause is known and cannot be fixed anytime soon. They also shared that the problem has to do with table grid and there is a workaround that might help. Please try to remove all table/cell widths specified in % and set fixed widths everywhere. That should make page numbers in TOC valid.

Sorry again for the bad news and thank you for your patience.

The workaround seemed to work in the first 18 pages but eventually, the problem reoccurs.

If there is anything else you can suggest in terms of a workaround then, please, let me know. Aspose.Word plays a central role in a solution that took several months to complete and involved a number of developers yet, this bug might prevent its release.

Please attach your problematic document here (the one you just mentioned). I will show it to the layout team leader and if he suggests something, I will let you know.


Thanks.