Free Support Forum - aspose.com

Head sections numbering is not working

Hi,

After we have upgraded Aspose.Words from version 16.4.0 to 18.2.0 we have an issue and the numbering of just Head sections is not working and they all have number 1.

For example:
1 Introduction
1.1 Description
1.2 Access
1.3 Confirmation
1.4 Plan
1.4.1 Classroom
1 Construction
1.1 Analysis
1.1.1 Classroom
1.1.2 Kitchen
1 Zones
1.1 Free

In the attachment there is a code file showing how we are implementing the numbering:
Document.zip (1.9 KB)

Could you please advise us what we need to change to work in the latest version or maybe this is an existing bug?

Thank you.

@dazzknowles,

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

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to 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 and upload them.

Hi,

Please find the attachment which contains following resources:
Sample.zip (2.2 MB)

  • As input we use BaseTemplate.docx document(located in DocumentSample) and data from DB(created some dummy data).
  • Report_Created_With_v18.5.0.docx is the output Word file created with latest version 18.5.0 that shows the undesired behavior.
  • Report_Created_With_v16.4.0.docx is the output Word file created with version 16.4.0 that shows the desired behavior.
  • DocumentSample is the standalone console application and its output files are created in folder UploadedFiles.

Thanks.

@dazzknowles,

Thanks for sharing the detail. Please use List.IsRestartAtEachSection property as shown below in your code to get the desired output.

doc.MailMerge.Execute({"Title"}, {"ReportTitle"})

For Each list As List In doc.Lists
    list.IsRestartAtEachSection = False
Next

' TOC
doc.UpdatePageLayout()
doc.UpdateFields()

@tahir.manzoor,

Using the List.IsRestartAtEachSection property, the word document is created correctly with the latest version 18.5.0 too.

Thanks for your help.

@dazzknowles,

Thanks for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.