Renumbering starts at 1 again

Hello,
the numbering in the ‘Bilanz’ document should start at 2.
The numbering in the ‘GuV’ document should start at 3.

When I append the ‘GuV’ to a document, the numbering persists.
However, if I do the same with the ‘Bilanz’, the numbering resets to 1. Why is that? What is the difference? In Word, they have the same settings except for the numbers.

I have an example project here
example.zip (6.8 MB)

Kind regards,
@Nachti .

@Nachti You should use ImportFormatMode.KeepSourceFormatting and specify ImportFormatOptions.KeepSourceNumbering option to get the expected result:

ImportFormatOptions opt = new ImportFormatOptions();
opt.KeepSourceNumbering = true;

Aspose.Words.Document doc = new Aspose.Words.Document(@"C:\Temp\Default.dotx");
Aspose.Words.Document doc2 = new Aspose.Words.Document(@"C:\Temp\Bilanz.docx");

doc.AppendDocument(doc2, ImportFormatMode.KeepSourceFormatting, opt);

doc.Save(@"C:\Temp\result.docx");

Aspose.Words.Document doc3 = new Aspose.Words.Document(@"C:\Temp\Default.dotx");
Aspose.Words.Document doc4 = new Aspose.Words.Document(@"C:\Temp\GuV.docx");

doc3.AppendDocument(doc4, ImportFormatMode.KeepSourceFormatting, opt);
doc3.Save(@"C:\Temp\result2.docx");

result.docx (45.7 KB)
result2.docx (41.3 KB)

@alexey.noskov

But I want to keep ‘UseDestinationStyles’. Why does it work for ‘GuV’ but not for ‘Bilanz’ ?

@Nachti

@Nachti
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-26612

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Do you have an idea when it will be fixed ?

@Nachti Unfortunately, there are no estimates yet. The issue is currently in the queue for analysis. Once analysis is done we will be able to provide you more information or a fix.

@alexey.noskov

I think there has been enough time now for an analysis. Is there already a solution or new information ?

@Nachti

@Nachti We have already completed analyzing the issue. The ImportFormatOptions.KeepSourceNumbering option was originally introduced for the cases when nsid of imported list equals to the nsid of list with same listId in destination document.
Word in this case always reuses existing list, but this option (that has no analogue in Word) allows to change this behavior. In the attached documents, nsids of the imported from the source and existed in destination documents are different, so this option is not applicable here.

The description for the option in summary is misleading. And actually it is expected that source list will be preserved in any case with this option. We could change the summary for the option and specify there that this is ‘for clashed nsids’ only. However, we will try to extend the option so that it actually will try to preserve original list numbering in any cases. Probably, this is not possible in all cases, but we can try to solve most of them.

@alexey.noskov

But we want to use ‘UseDestinationStyles/Numbering’, not ‘KeepSourceNumbering’…

@Nachti The problem you have reported earlier is that after appending document numbering of the source document has been changed from 2 to 1. So the goal is to keep the numbering from the source document after appending it. Correct me if I am wrong.

@alexey.noskov

yes but with UseDestinationStyles…

@Nachti KeepSourceNumbering is not a member of ImportFormatMode it is a separate option that allows controlling how numbering is handled upon merging documents.

@alexey.noskov
sorry, may be it was not clear enough:

the chapter number in file Bilanz is 2 (see

but in the result.docx, the chapter name becomes 1 (see

Two questions:

  1. Why did it change and how could I fix it probably ?

  2. The chapter number in GuV starts with a 3 and in the the result2.docx it is still a 3.
    Why isn’t the same thing happening as with the ‘Bilanz’ chapter number ? For me it looks like a different behaviour.

@Nachti You are clear and we have logged an issue in our defect database. Usually to keep original list numbering after appending document it is enough to specify KeepSourceNumbering option:

ImportFormatOptions opt = new ImportFormatOptions();
opt.KeepSourceNumbering = true;

But in your case this option does not work. So the issue is still open. We will keep you informed and let you know once it is resolved.