Thanks for your inquiry. Could you please show me your code and attach your document and the image here for testing? I will check the problem on my side and provide you more information.
Best regards,
Thanks for your request. Probably this code does not work for you because you are using DOCX documents and your shapes are actually DrawingML. In 9.5.0 version we added partial support of DrawingML into Aspose.Words.
May I ask you to attach your documents here for testing? I will check them and provide you more information.
Best regards,
Thank you for additional information. I was right; there is DrawingML in your document. DOC format does not support DrawingML that is why all DrawingML are converted to regular shapes after converting to DOC.
Best regards,
Thanks for your request. The code provided above in this thread is a workaround of the problem with image size. If you need just insert an image into a header of your document, you can just move DocumentBuilder cursor into a header and insert an image using Documentbuilder.InsertImage method.
Please let me know if you have some special requirements. We will be glad to help you.
Best regards,
Hi,
What I need is to replace an existed image on DOCX template with an new image that will keep the size of the old one. the code above works perfectly for DOC document
Thank you
Thank you for additional information. Currently, there is no way to replace an image inside DrawingML object using Aspose.Words. however, I can suggest you a simple workaround of this issue. You can just convert your document to DOC and then reopen DOC file using Aspose.Words. In this case, all DrawingML objects will be converted to Shapes and you will be able to use the code provided above to replace images.
Best regards,
Hi Kamel,
Thanks for your inquiry.
Hopefully your work around will suffice for now. We will inform you when further members of the DrawingML class are made avaliable and what you are trying to achieve can be done directly.
Our apologises for any inconvenience.
Thanks,
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.