Imported shape is cropped in the output document

Hello,

I’m trying to import an image from one document to another, but the image in the output is cropped on top and bottom for some reason. I think it might have something to do with the fact that the image is rotated, but I’d expect it to look the same as in the input document. Why is this happening?

Please find an example solution with input document attached ShapeImportTest.zip (209.8 KB)

Thanks,
Anna

@acturisaspose,

We have logged this problem in our issue tracking system with ID WORDSNET-21489. We will further look into the details of this problem and will keep you updated on the status of linked issue. We apologize for your inconvenience.

@acturisaspose,

Regarding WORDSNET-21489, the reason for this behavior is in ‘compatibility mode’ option which is set by default when the Document is saved.

Document dstDoc = new Document();
// dstDoc.Compliance == OoxmlComplianceCore.Ecma376

This leads to the fact that compatibilityMode is not recorded into the final file and is accepted by MS Word as the default value compatibilityMode == 12. If such a document is opened in MS Word, then “[Compatibility Mode]” label is found in the title, the picture is cropped, and if you try to resize the picture, then, unlike your original file, the picture does not change its dimensions separately vertically and horizontally, but only maintaining the proportions. Most likely, this is the reason for the image cropping.

Solution.
Explicitly specify Compliance corresponding to the latest version of MS Word when saving the document.

Document dstDoc = new Document();
...
OoxmlSaveOptions so = new OoxmlSaveOptions();
so.Compliance = OoxmlCompliance.Iso29500_2008_Strict;
dstDoc.Save("output.docx", so);

So, please specify OoxmlCompliance.Iso29500_2008_Strict option explicitly to get the expected output.