@alexey.noskov please find the sample working solution which has exact scenario which we are trying to explain. please note that the issue occurring on V23 and not on V14 the snapshot which shared in prior discussion
@osakpal Thank you for additional information, but the MC_CovComprehensive_NotWorking.docx file specified in the XML file is not attached. Could you please attach it here too.
@osakpal The code you have provided can be simplified to the following:
string rootPath = @"C:\Temp";
Document mainDoc = new Document($"{rootPath}\\MC_CovComprehensive_NotWorking.docx");
// Load the additional documents to be appended
Document Subdoc1 = new Document($"{rootPath}\\MC_Header_Cov_Line.docx");
Document Subdoc2 = new Document($"{rootPath}\\MC_CovLineBodilyInjury_notWorking.docx");
Document Subdoc3 = new Document($"{rootPath}\\MC_CovLinePropertyDamage.docx");
Document Subdoc4 = new Document($"{rootPath}\\MC_CovSafetyRidingApparel.docx");
Document Subdoc5 = new Document($"{rootPath}\\MC_CSCredit.doc");
// Append the documents to the main document
mainDoc.AppendDocument(Subdoc1, ImportFormatMode.KeepSourceFormatting);
mainDoc.AppendDocument(Subdoc2, ImportFormatMode.KeepSourceFormatting);
mainDoc.AppendDocument(Subdoc3, ImportFormatMode.KeepSourceFormatting);
mainDoc.AppendDocument(Subdoc4, ImportFormatMode.KeepSourceFormatting);
mainDoc.AppendDocument(Subdoc5, ImportFormatMode.KeepSourceFormatting);
foreach (Section s in mainDoc.Sections)
{
s.PageSetup.SectionStart = SectionStart.Continuous;
}
//Save the Form into PDF
string filename = $"{rootPath}\\MergerSampleDocument_14.8.pdf";
mainDoc.Save(filename, SaveFormat.Pdf);
@osakpal Could you please attach the the problematic DOCX and PDF documents produced on your side? It looks like some font substitution issue. Have you tried implementing IWaringCallback?
@alexey.noskov Please find the V14 and v23 word document which has formatting and font issues. also we have attached the output PDF files for your reference.
In addition, there is an observation from our side is that while merging the main document with subdocument V14 is applying the format setting of main document. While in V23 we observed that the settings are getting applied which is of subdocument and not of main document. Is this something that has been changed inside the aspose DLL ? it can be observed in form 1 for the font issue.
@osakpal Thank you for additional information. But unfortunately, I cannot reproduce the problem on my side. In your template you have merge fields, which are filled before merging documents. I tried with dummy data and the above provided code to merge the documents, but the problem is not reproducible. Is the problem reproducible on your side if save the output as DOCX? If not, is the problem reproducible if convert the output DOCX to PDF?
@alexey.noskov the issue is reproducible if convert the output DOCX to PDF. Also,
can you also confirm below observation
In addition to this there is an observation from our side is that while merging the main document with subdocument V14 is applying the format setting of main document. While in V23 we observed that the settings are getting applied which is of subdocument and not of main document. Is this something that has been changed inside the aspose DLL ? it can be observed in form 1 for the font issue.
Could you please attach your output DOCX documents?
As far as I know there were no changes in this behavior. As you can see you are using ImportFormatMode.KeepSourceFormatting in this mode Aspose.Words should preserve the original documents formatting.
@alexey.noskov Please find the sample docx file and output generated using Aspose V23.
Please note that the same document rendering correctly in Aspose V14.
In AddSubDoc document method reference the document attached as
try
{
// Load the additional documents to be appended
Aspose.Words.Document Subdoc1 = new Aspose.Words.Document($"{rootPath}\\623e9540-f174-40c0-9dba-e028a79df6ba-MC_CovLineBodilyInjury_3_t-2.docx");
Aspose.Words.Document Subdoc2 = new Aspose.Words.Document($"{rootPath}\\623e9540-f174-40c0-9dba-e028a79df6ba-MC_CovLineBodilyInjury_3_t-3.docx");
Aspose.Words.Document Subdoc3 = new Aspose.Words.Document($"{rootPath}\\623e9540-f174-40c0-9dba-e028a79df6ba-MC_CovLineBodilyInjury_3_t-4.docx");
Aspose.Words.Document Subdoc4 = new Aspose.Words.Document($"{rootPath}\\623e9540-f174-40c0-9dba-e028a79df6ba-MC_CovLineBodilyInjury_3_t-5.docx");
// Append the documents to the main document
mainDoc.AppendDocument(Subdoc1, ImportFormatMode.KeepSourceFormatting);
mainDoc.AppendDocument(Subdoc2, ImportFormatMode.KeepSourceFormatting);
mainDoc.AppendDocument(Subdoc3, ImportFormatMode.KeepSourceFormatting);
mainDoc.AppendDocument(Subdoc4, ImportFormatMode.KeepSourceFormatting);
@omkars Thank you for additional information. I finally managed to reproduce the problem on my side. It can be reproduced by simple conversion of 623e9540-f174-40c0-9dba-e028a79df6ba-MC_CovLineBodilyInjury_3_t-5.docx document to PDF.
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-27399
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.
Hello @alexey.noskov , Additionally we also found below issues, here header of table is shifting towards right compared to input doc. And we also observed output is different in v14 and v23. Aspose v14 was working correctly.
@alexey.noskov can you able to tell us what word docs cause this problem? is there a specific criterion to check those forms which would cause an issue for aspose during merge and conversion?
@osakpal The issue occurs because MS Word merges adjacent tables with different indents, and Aspose.Words does not.
The document appears to be generated by Aspose.Words. In the source xml, there are three consecutive w:tbl elements. MS Word treats them as a single table. Aspose.Words does not merge the tables because of different table attributes. Specifically, table 1 and table 2 have different left indents specified. Apparently, the logic that checks if a pair of tables can be merged should be revised.
For now the issue has been postponed and is not yet scheduled for development.