After using the ExtractPages function, the numbers in the headings are broken

good day

in the new version of aspose, the numbering in headings is broken after using the ExtractPages function. I have tested it in version 32.2 - there it is ok, in versions 32.5 and 32.6 the numbering is wrong.

Could you advise me on this?
THANK YOU IN ADVANCE

@benestom Could you please attach your input document here for testing? We will check the issue and provide you more information.

Document: Input.docx (1.5 MB)

my procedure:

docClone.Sections.Clear();
input.UpdatePageLayout();

for (int i = 0; i < input.PageCount; i++)
{
    Section importedSec = (Section)docClone.ImportNode(input.ExtractPages(i, 1).Sections[0], true, ImportFormatMode.KeepSourceFormatting);
    docClone.AppendChild(importedSec);
}

on page 17 error numbering

@benestom Please try specifying ImportFormatOptions.KeepSourceNumbering options. Please see the following code:

Document input = new Document(@"C:\Temp\in.docx");
Document docClone = (Document)input.Clone(false);

ImportFormatOptions opt = new ImportFormatOptions() { KeepSourceNumbering = true };
for (int i = 0; i < input.PageCount; i++)
{
    Document page = input.ExtractPages(i, 1);
    docClone.AppendDocument(page, ImportFormatMode.KeepSourceFormatting, opt);
}

docClone.Save(@"C:\Temp\out.docx");

thank you very much, it took…

1 Like

good day,
I came across a document where the numbering of headings is completely overnumbered. using previous decomposition and composition.

Please can you check.
batNumbering.jpg (104.8 KB)
Input.docx (495.4 KB)

@benestom
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-25738

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.

Thanks for finding out.
If in the MS Word application I find the title number and enter continue numbering in out.doc, the numbers are corrected.
Is it possible to temporarily adjust the numbers in the document until the error is corrected?
Thanks in advance for any reply.

@benestom The issue is currently in the queue for analysis. Once analysis is done we will be able to provide you more information, fix or workaround. Please accept our apologies for your inconvenience.

okay
I still found a case where 5 pages become 7 pages when parsing. It does the caption next to the image. You can look at it.
Thank you in advance
Input.docx (62.7 KB)

@benestom
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-25753

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.

the padding in the document is generating styles, maybe that’s causing the problem…

image1.png (2.5 KB)

@benestom, could you please clarify what issue your last comment is related to?

the last comment was about the issue WORDSNET-25753, I just wanted to show that it creates new styles in the document.

May I ask how these tasks look like? I have two versions of aspose installed in the project because the last one makes a mess of the numbering.

@benestom WORDSNET-25753 is about incorrect table layout after rendering. This issue has been postponed and is not yet scheduled for development.
WORDSNET-25738 is about incorrect numbering after using ExtractPages method. This issue is already resolved in the current codebase. The fix will be included into the next 23.10 version. We will let you know once it is released.

The issues you have found earlier (filed as WORDSNET-25738,WORDSNET-25753) have been fixed in this Aspose.Words for .NET 23.10 update also available on NuGet.

Good day,

after using the following function

docClone.Sections.Clear();
doc.UpdatePageLayout();

ImportFormatOptions opt = new ImportFormatOptions() { KeepSourceNumbering = true };
for (int i = 0; i < doc.PageCount; i++)
{
    Document page = doc.ExtractPages(i, 1);
    docClone.AppendDocument(page, ImportFormatMode.KeepSourceFormatting, opt);
}

My font changes from title 1 to normal.
You can check it out?
Thank you in advance

FR-Z.1_BACK01_V01.docx (401.3 KB)

@benestom Unfortunately, I cannot preproduce the problem on my side. Also, since documents are rejoined after splitting and clone of the original document is used as a target document, it would be more correct to use ImportFormatMode.UseDestinationStyles to retain original styles:

Document doc = new Document(@"C:\Temp\in.docx");
Document docClone = doc.Clone();
docClone.Sections.Clear();
doc.UpdatePageLayout();

ImportFormatOptions opt = new ImportFormatOptions() { KeepSourceNumbering = true };
for (int i = 0; i < doc.PageCount; i++)
{
    Document page = doc.ExtractPages(i, 1);
    docClone.AppendDocument(page, ImportFormatMode.UseDestinationStyles, opt);
}

docClone.Save(@"C:\Temp\out.docx");