insertHtml not overlaying transparent image correctly

Hi,

(Using the latest nuget build of Words.Net BTW)

Trying to convert some HTML to a Word document with a transparent image over another image and it’s not rendering correctly, created a simple demo for you:

namespace SomeAsposePoC
{
    class Program
    {
        static void Main(string[] args)
        {
            Aspose.Words.License license = new Aspose.Words.License();
            license.SetLicense("Aspose.Total.lic");

            var html = @"
<html>
<body>
    <div style=""position: relative;"">
        <img src=""https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/%22Broke%2C_baby_sick%2C_and_car_trouble%21%22_-_Dorothea_Lange%27s_photo_of_a_Missouri_family_of_five_in_the_vicinity_of_Tracy%2C_California.jpg/350px-%22Broke%2C_baby_sick%2C_and_car_trouble%21%22_-_Dorothea_Lange%27s_photo_of_a_Missouri_family_of_five_in_the_vicinity_of_Tracy%2C_California.jpg"">
        <img style=""position:absolute; top: 10px; left: 10px;"" src=""https://www.fnordware.com/superpng/straight.png"" />
    </div>
</body>
</html>";

            var document = new Aspose.Words.Document();

            Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(document);

            builder.MoveToDocumentEnd();

            builder.InsertHtml(html);

            Aspose.Words.Saving.OoxmlSaveOptions ooSave = new Aspose.Words.Saving.OoxmlSaveOptions();
            ooSave.Compliance = Aspose.Words.Saving.OoxmlCompliance.Iso29500_2008_Strict;
            ooSave.SaveFormat = Aspose.Words.SaveFormat.Docx;
            document.Save(@"c:\temp\overlay.docx", ooSave);
        }
    }
}

What I get is the base image then the transparent one is just a red X which it knows is an object and if I then change the source of that image to a local copy of that image it overlays correctly so not sure why the object is losing it’s image location information?

Any thoughts?

Simon

@simon.fairey,

But your code, when executed by using the latest version of Aspose.Words for .NET i.e. 18.11, produced this output document on our end:
image overlying.zip (62.5 KB)

Hi

Can you try opening the attached which is what is generated for me and see what you get as maybe it’s a version or Word issue? Your attachment does indeed look fine and checked and I’m definitely using the latest version of Aspose.Words, attached a screenshot with details

temp.zip (142.4 KB)

Si

@simon.fairey,

Yes, we can see a small red cross in the ‘overlay.docx’ document that you shared when viewing it with MS Word 2016 on our end. Please open this HTML file with web browser and MS Word on your end to see if these images are loading properly?
test-html.zip (427 Bytes)

Hi, apologies for the delay in responding, it looks fine in Chrome but in Word (latest version Office 365) I see this:

image.png (16.9 KB)

Cheers

Si

@simon.fairey,

We are still unable to reproduce this issue on our end when using the following code with the latest version of Aspose.Words for .NET i.e. 19.1:

var html = @"
<html>
<body>
    <div style=""position: relative;"">
        <img src=""https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/%22Broke%2C_baby_sick%2C_and_car_trouble%21%22_-_Dorothea_Lange%27s_photo_of_a_Missouri_family_of_five_in_the_vicinity_of_Tracy%2C_California.jpg/350px-%22Broke%2C_baby_sick%2C_and_car_trouble%21%22_-_Dorothea_Lange%27s_photo_of_a_Missouri_family_of_five_in_the_vicinity_of_Tracy%2C_California.jpg"">
        <img style=""position:absolute; top: 10px; left: 10px;"" src=""https://www.fnordware.com/superpng/straight.png"" />
    </div>
</body>
</html>";

var document = new Aspose.Words.Document();

Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(document);

builder.MoveToDocumentEnd();

builder.InsertHtml(html);

Aspose.Words.Saving.OoxmlSaveOptions ooSave = new Aspose.Words.Saving.OoxmlSaveOptions();
ooSave.Compliance = Aspose.Words.Saving.OoxmlCompliance.Iso29500_2008_Strict;
ooSave.SaveFormat = Aspose.Words.SaveFormat.Docx;
document.Save(@"E:\temp\19.1.docx", ooSave); 

See attachment: 19.1.zip (62.5 KB)
And here is how it appears to us when opened with MS Word 2019:

Hmmm something very strange going on, using the exact same code and updating to 19.1 of Words it still doesn’t work for me and the files generated are clearly different:

image.png (5.0 KB)

Will have a look and see if maybe some odd compiler settings or something as at a loss in terms of what to try next!

@simon.fairey,

We will wait for your further input on this topic.

Please list complete steps that we can follow to reproduce the exact issue on our end. Also, please ZIP and share your Aspose.Words 19.1 generated DOCX file here for our reference.

P.S. We have tested this scenario over 64-bit Windows 10 OS so far.