Table is losing style when we append the documentsResize.zip (86.5 KB)
. When we debug found that ‘Automatically resize to fit contents’ is causing the issue. Could you please help. Attaching input DOCX and oputput DOCX and PDF documents.
If I need to append another document with similar conetnt (Automatically resize to fit contents), can I use below code?. Solution is working but wanted to check with you, if it is the rightway of doing.
Also my understanding is that deepClone will copy the document and this is useful when we wanted to generate more than one copy. appendDocuemnt will append the docuemnt to the last section of the document. Could you kindly explain how these two methods are working together in your solution. Thank you.
Document doc = new Document(“C:\Temp\Resize\input.docx”);
Document doc2 = new Document(“C:\Temp\Resize\input2.docx”);
The Document.deepClone method will perform a deep copy of the Document. This will copy all the Styles, Page Setup information such as Page Width / Height, orientation and many other attributes into the newly created Document instance. But to simulate Document merged = Document();, we needed this copy of the Document as blank that is why we are passing false to deepClone. The Document.ensureMinimum method creates one Section with one Paragraph in this new Document. The workaround was to ensure that we have all the required Styles and PageSetup information readily available in new Document in which we are appending other documents to. Please let us know if you have any troubles and we will be glad to look into this further for you.
This solution is not working when we have table with ‘‘Automatically resize to fit contents’’, your deepclone() solution is working fine. My question is when we wanted to append multiple documents, can we use deepclone() multiple times like below. Solution is working finr but wanted to check with you if it is the rightway. Thank you.
Document doc = new Document(“C:\Temp\Resize\input.docx”);
Document doc2 = new Document(“C:\Temp\Resize\input2.docx”);
Please ZIP and attach your simplified input.docx, input2.docx, 20.8.docx documents and a screenshot highlighting the problematic area in 20.8.docx here for further testing. We will then investigate the outputs produced against both cases (with and without using deepClone) on our end and provide you more information.