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

Free Support Forum - aspose.com

Complex grid breaks for two templates - Attachment4, Attachment 5

Complex grid documents are moving to next line when merged with Aspose. Attaching the Aspose Generated along with attachments.

Aspose Generated.docx (186.7 KB)
Attachment1.docx (25.9 KB)
Attachment2.docx (113.0 KB)
Attachment3.docx (19.1 KB)
Attachment4.docx (49.4 KB)
Attachment5.docx (27.5 KB)

@NIKHIL.AGGARWAL30.OPTUM.COM Actually there are several problems upon merging the document. The main is that table in the Attachment4.docx is broken upon import.
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-24929

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 second issue, your documents were created using different version of MS Word and as a result have different set of compatibility options. When you concatenate the documents compatibility options of the main document are applied and the content is reflowed appropriately. This might lead to difference in layout of the appended documents.

The third issue is that some of your documents does not have headers/footers, but they are inherited form the previously appended documents. You can avoid this using HeadersFooters.LinkToPrevious method. But in this case an empty headers/footers are added to the section that also might push the content down. You can reset size of empty paragraphs in headers/footers to avoid this:

string[] docs = new string[] {
    @"C:\Temp\Attachment1.docx",
    @"C:\Temp\Attachment2.docx",
    @"C:\Temp\Attachment3.docx",
    @"C:\Temp\Attachment4.docx",
    @"C:\Temp\Attachment5.docx"
};

Document result = null;
foreach (string path in docs)
{
    Document doc = new Document(path);
    doc.FirstSection.PageSetup.SectionStart = SectionStart.NewPage;
    doc.FirstSection.HeadersFooters.LinkToPrevious(false);

    if (result == null)
        result = doc;
    else
        result.AppendDocument(doc, ImportFormatMode.KeepSourceFormatting);
}

// Reset size of empty headers/footers.
NodeCollection headersFooters = result.GetChildNodes(NodeType.HeaderFooter, true);
foreach (HeaderFooter hf in headersFooters)
{
    if (string.IsNullOrEmpty(hf.ToString(SaveFormat.Text).Trim()))
        hf.FirstParagraph.ParagraphBreakFont.Size = 0;
}

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

I have tried with given code but still on page number 4th grid is getting broken and moved to next page.

Check screenshot image.png (18.4 KB)

I have attached document after using given code.
Merged_d6d5caf0-73e2-4b9e-aca0-cfbf8e459ad3_638113044588939288.docx (190.7 KB)

@Dhanashri0709 Yes, as I have mentioned in my previous answer, this problem has been logged as WORDSNET-24929. Currently the issue is in the queue for analysis. We will keep you updated and let you know once it is resolved or we have more information for you.

Can you please tell me approximately how much time it will take for analysis?

@Dhanashri0709 It is difficult to tell for sure. Usually new issues are analyzed within one-two weeks.

Oh. :frowning:

It will be great if you guys able to do respond on this issue as possible as.

Thank you for response :slight_smile:

1 Like

Any update on this?
We have stuck with this issue so because of that we cannot release this on production with aspose.

@Dhanashri0709 Unfortunately, there are no news regarding the issue. The issue is still in the queue for analysis. We will keep you updated and let you know once it is resolved or we have more information for you.

1 Like

Any update on this?

It’s removing below element randomly after merging the attachment4.

<w:vMerge w:val=“restart” />

@Dhanashri0709 Unfortunately, there are not news yet. We will keep you updated and let you know once it is resolved or we have more information for you.