We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Creating TOC for text with non-BodyText OutlineLevel works unexpected

I am processing docx document over old processing (interop+word process) and with new logic over Aspose and I am facing with an issue over new logic.


Processed document contains TOC definition - TOC \o “1-3” \h \z \u that should harvest headlines and other content. Processing of headlines that are within headline styles is the same on both processing logic. But I realize that I have an issue with headlines that are not within styles - headline1-headline9 and that are defined with OutlineLevel that is not BodyText, (per istance Level1). With that content I have following issue :

In TOC content that originally has OutlineLevel that is not BodyText will take original formatting like font color, size, etc. Result is that I will in TOC have line with bigger font than others and in custom color.

I am simply doing :

document.UpdateFields();
document.UpdatePageLayout();

What is the problem. I tried to edit TOC (1-9) styles to control visual experience. Problem is that custom headline is not of TOC styles and I can not do anything with it.

Please suggest me how to tell Apose to generate for me TOC on unify way. In addition, on old processing logic this works as expected. Also on Apose logic, when I open generated document in Word and press UpdateTOC, problematic custom headline will be re-formatted and will be OK.

Thanks,
Rastko

Hi Rastko,


To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document
  • Aspose.Words generated output document showing the undesired behavior
  • Your expected document which shows the correct output. Please create this document using Microsoft Word application.
  • Please create a standalone console application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.

Best regards,
Hi,

here is the simple code snippet.
There were attached 3 files.

1. Initial document Template.docx that has defined TOC
2. AsposeGenerated.docx document after generation with code snippet
3. Document that I expect to have - ExpectedGeneration.docx (that is the version that I get with classic logic)


public static void UpdateTableOfContents(string documentName)
{
Aspose.Words.Document document = new Aspose.Words.Document(documentName);
document.UpdateFields();
document.UpdatePageLayout();
document.Save(documentName);
}

Hi Rastko,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 16.1.0, we managed to reproduce this issue on our end. We have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-13268. Your thread has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

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


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

Many thanks,


it works perfectly now.