@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");
@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.
@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.
@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.
@uttamvs, we have completed the analysis of the issue. Unfortunately, we cannot provide you any reliable estimate when it will be resolved as the issue is quite complex.
@uttamvs, please accept our apologies for your inconvenience. We will deliver the fix according to the terms mentioned in Free Support Policies.
You can obtain Paid Support Services. In this case the issue will be treated on priority basis, along with the direct access to our Paid Support management team. Purchasing Paid Support Services will push the issue upper in the queue.
@uttamvs, according to Free Support Policies, there is no timeline for fixes in free support. New issues get in the queue, and their resolution depends on complexity and relationship with other issues.
You mentioned that the issue is not reproducible with OpenXML SDK. If it’s not too much trouble for you, could you please post a sample code that shows how OpenSDK handles the table in Attachment4.docx? I would forward this sample code to our development team so they can check whether it can help them.
@denis.shvydkiy it’s not a new table we are creating. The table is already in template and it’s removing “<w:vMerge w:val=“restart”/>” tag from letter after merging with other documents but somehow OpenXML SDK is managing this very well.
It would be appreciated if you let us know why “<w:vMerge w:val=“restart”/>” this tag is removing? so that we can work on updating the table structure in template.