list.IsRestartAtEachSection does not work with .odt

Hi,
I create a document with several sections. Each section contains numbered lists. They should begin with 1 in each section. I set list.IsRestartAtEachSection = true. For docx, dotx, doc,… this works, for odt unfortunately not. Is there a way to reset the numbering for each section even when outputting as odt?

@MarkusPlesoft

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

  • Your input document.
  • Please attach the output ODT file that shows the undesired behavior.
  • Please attach the expected output ODT 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 will 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 tahir.manzoor,

the attached application ListNumberingTest.zip (8.3 KB) creates a document with a list and saves it in various types.

The numbering in docx, doc, dot and rtf starts correctly at 1 after each section change, but continues in dotx, docm, dotm, odt and ott.

Can you reproduce the described behaviour?

The code is an extension of the example in https://reference.aspose.com/net/words/aspose.words.lists/list/properties/isrestartateachsection. It also points out that only docx, dot and rtf are supported. But how can this be implemented for other types?

In our real application we have a dot template. We clone it, edit it with Replace and insert an rtf file with the list in one place. Then we add the clone in a new section to the existing document. We then save the document as dotx and open it with Process.Start(). The user can then decide whether and where to save the document.

@MarkusPlesoft

In this case, you need to clone the list or create new list and set it to paragraphs in your desired section.

Is there a way to prevent contained lists from merging when inserting a second document into the first? How would you proceed here?

I think I found a solution:

This code does not work with dotx, odt,…:

Document attachDoc = (Document)templateDoc.Clone(true);
builder.InsertBreak(BreakType.SectionBreakNewPage);
ImportFormatOptions importOptions = new ImportFormatOptions()
{ KeepSourceNumbering = true };
builder.InsertDocument(attachDoc, ImportFormatMode.KeepSourceFormatting, importOptions);

But it is:

Document attachDoc = (Document)templateDoc.Clone(true);
ImportFormatOptions importOptions = new ImportFormatOptions()
{ KeepSourceNumbering = true };
templateDoc.AppendDocument(attachDoc, ImportFormatMode.KeepSourceFormatting, importOptions);

@MarkusPlesoft

It is nice to hear from you that you have found the solution of your issue.

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-19351. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-19351) have been fixed in this Aspose.Words for .NET 19.11 update and this Aspose.Words for Java 19.11 update.