Autofields in Table Of Contents

Hi,


I have a document which I am manipulating with Aspose.net Words. Everything is working perfectly except for some titles in the Table Of Contents that contain autofields.

In the Word document these fields are automatically incremented like chapter headers, but instead of a number, they are represented by a letter.
After calling UpdateFields on the document, the TOC is updated, but the autofields are shown as numbers and not as letters.

In Attachement you can find the source and resulting file. The code I use is very simple:

Document doc = new Document(“input.doc”);
doc.UpdateFields();
doc.Save(output.docx);

The output extension does not make a difference in result.

Hi Nick,


Thanks for your inquiry. But updating TOC in “input.doc” with both the latest version of Aspose.Words 14.1.0 as well as with Microsoft Word 2013 (select the TOC content -> Right click -> click update Field -> choose “Update entire table”) remove those last five entries from TOC. This seems to be an expected behavior. Please let us know if we can be of any further assistance.

Best regards,

Hi Awais,


The code I posted in my first message was used with the latest 14.1.0 dll of Aspose to generate the attached output.docx file, which keeps the lines but does turns the A-B-C references into 1-2-3 references.

Updating the TOC manually in Word (2010 or 2013) keeps those letter references in tact so I don’t know why you say the lines get removed?

Hi Nick,


Thanks for the additional information. For some reasons, your output differs from the output produced on our end. Please try producing the output by executing the attached console application on your end and see how the output document looks like in “Bin” directory.

Moreover, I have attached the screenshot of the TOC output here for your reference. Could you please also double check if you attached the correct input document with your initial post?

Best regards,

Hi Awais,


Thank you for providing me with the sample project.
I downloaded the project and placed the latest Aspose.Words dll (downloaded from http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx, DLL only) in the bin folder, together with my licence file. I tried both the .NET 2.0 and 3.5 versions to check for possible differences, both gave the same result.

I recorded a small video to show you the exact output I got, using your sample application with the input document you provided. You can find the video here: http://www.youtube.com/watch?v=YnTjRw2zjL8

First I open up the output file that you provided with the archive and refresh the field to show you what the actual output should be. Next I generate a new output document using the latest words.dll and your provided input document. As you can see when I open the generated output document, the extra lines are still visible, but with 1-5 instead of A-E. After refreshing the TOC in Word, everything is back the way it should be.

I have Office 2010 on my computer, but refreshing the TOC on a computer with Office 2013 provides me with the same result.

Hi Nick,


Thanks for the additional information. I managed to reproduce this issue in Dutch (Belgium) culture only and have logged this problem in our issue tracking system as WORDSNET-9802. Our development team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

Hi Awais,


Might it be possible to determine the cause of the broken headlines in the TOC? So that I might be able to work around this problem by modifying the source document to use other autofields?

As I have no access to the Aspose sourcecode, it would be very difficult for me to determine the exact cause for this.

Hi Nick,


Thanks for your inquiry. Currently, this issue is pending for analysis and is in the queue. This issue first needs to be investigated to find the exact source of problem and then we’ll investigate the best possible way to fix the issue. Once this issue is analyzed, we will then be able to provide you more information. Sorry for the inconvenience.

Best regards,

Hi Awais,


I have found a workaround for this issue by defining a new Style which includes autonumbering with letters and applying the same styling to it.

This way Aspose correctly generates all headers and the numbering in the TOC is displayed correctly. The issue is still valid as the behaviour is unexpected but at least I can work around the problem :slight_smile:

Thank you for looking into this!
Hi Nick,

Its great you were able to find a workaround. We will be sure to inform you via this thread as soon as this issue is resolved.

Best regards,

The issues you have found earlier (filed as WORDSNET-9802) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.