Hi,
In my project I’m importing content into a template doc and noticed some weird behaviour from IfFields containing images with Square wrap type when they are imported into footer. I’m cloning paragraph nodes from the source document, and then inserting them one by one into the target document. I then perform UpdateFields and unlink the iffields in the document. This results in an image which retains the ‘Square’ wrap but renders as if it was set to ‘In front of text’. I’ve attached a sample project which replicates this behaviour. Could you let me know if there is a way to correct the wrap to render properly?
Thanks,
Tomek
MergeUpdateExample.zip (41.3 KB)
@acturisaspose Could you please manually create and attach the expected output in MS Word and attach it here? It looks like MS Word uses different rules for floating shapes when they are in header or footer, since properties of shapes from the source document are preserved.
Hi Alexey,
What I was aiming for was to match how the document would look if the anchor was manually pasted into the target document’s footer and unlinked - please see attached. The breaks are rendered at the same Z-height as the picture, changing its position on the page, while on the output from the sample code the image hides the breaks.
Thanks,
Tomek
expected_beforeSolvingIfField.docx (67.4 KB)
expected.docx (67.1 KB)
@acturisaspose Thank you for additional information. I investigated the issue and the problem occurs because the output document produced by Aspose.Words in your code is optimized for old version of MS Word, which does not support floating shapes in header/footer. You can fix this by optimizing the document to newer version of MS Word using CompatibilityOptions.OptimizeFor method.:
document.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2019);