We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Include picture does not scale properly after updating image path using .NET

Hi Aspose Suport

We har changing our code from using Word Automation Mailmerge to using Aspose Document.Mailmerge

We are using Aspose Words version 18.5.0 for a Document.Mailmerge
We are using this Includepicture construct (that Works fine in Word automation Mailmerge):

{ INCLUDEPICTURE "{ IF { MERGEFIELD PathToImage \* MERGEFORMAT } <> 0,00 "{ MERGEFIELD PathToImage \* MERGEFORMAT }" "http://www.somesite.org/media/blank1.png" }" \d \* MERGEFORMAT }

(path to file changed for privacy reasons)

The construct itself Works fine, but the image in the resulting document is not scaled to fit page (when image is larger than page ) as it is when using Word automation mailmerge.

We have also tried the newest version 18.11 - but there is no difference

I believe that you have enough information here to try it out by yourself.

NB We have tried to preset an image size (left click on image - choosing Format Picture) - but doing that leaves us with an Aspect Ratio problem.

@StenBille

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

I have now created a standalone console application (C# visual studio 2019) that reproduces the problem. The application is attached in the zip file AsposeWordsTest.zip.

Also attached are:

  1. A word document that explains the application: GuideToAsposeWordsTest.docx (in a zip)
  2. A Word document that shows the expected behaviour: IncludepictureAsWordMailmergeDoesIt.docx (in a zip)
  3. A Word document that shows the undesired behaviour: ResultingMergeWithIncludepicture-637114756280827398.Docx (in a zip)
    AsposeWordsTest.zip (4.8 MB)
    GuideToAsposeWordsTest.zip (10.4 KB)
    IncludepictureAsWordMailmergeDoesIt.zip (4.7 MB)
    ResultingMergeWithIncludepicture-637114756280827398.zip (4.7 MB)
    NB - we are now using Aspose.Words version version 19.12.0.0 (license Aspose.Total.Lic)
    The example in this test application does not use an If construct but just an includepicture with a mergefield.

@StenBille

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-19664. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Support

Its been quite a while since we first reported this.

Do you know if anything is being done regarding this issue.

Kind regards
Sten Bille

@StenBille

Currently, this issue is under ‘In Review’ phase. Hopefully, this issue will be resolved in the next version of Aspose.Words. Please note that this ETA is not final at the moment. However, we will inform you via this forum thread once this issue is resolved.

The issues you have found earlier (filed as WORDSNET-19664) have been fixed in this Aspose.Words for .NET 20.5 update and this Aspose.Words for Java 20.5 update.

Thank you for your update.

Indeed the Includepicture is now handled so it will fit the page width and keep Aspect ratio (When Includepicture is inserted using CTRL+F9 and thereby appears “Frameless”- Aspose.Words version 20.5.0) .
But it puzzles me that you did not work on the entire functionality regarding Includepicture fields.
Because then you would have went on to fix issues such as when Includepicture is placed inside a Table Cell or when Includepicture actually has a “Frame” and you try your best to control the size and aspect ration by using Microsoft Word to set properties on the “Table Cell” or on the “Frame”.

So actually I do not think that you have fixed the problem. My customers still has’nt got the expected behaviour regarding Includepicture when we are using Aspose.Words in our product.

I expect you to reply that you are still working on Includepicture issues and that you will come up with a solution soon.

Kind regards
Sten Bille

@StenBille

The reported issue fixed according to shared documents and test case. We have tested the scenario with table’s cell and frame. We have not found any issue with output document. Please check the attached document. Docs.zip (4.7 MB)