Closed CallumES closed 2 years ago
I see that the out-of-the-box HTML-to-SimpleWPML does not do anything with the width and height attributes, so that explains why it's not reflected.
Let me see what I can do to rememdy that.
image-geometry-test.docx.zip image-geometry-test.swpx.zip
I updated the src/xsl/html2docx/baseProcessing.xsl
transform to copy the @height
and @width
attributes to the SWPX image element. With that change the pixel widths in the HTML are reflected in the DOCX file. The generated SWPX file and resulting DOCX file is attached.
The change is committed on the develop branch.
@drmacro When testing this out, images are now successfully constrained to the detailed size however I've noticed that tables now seem to be suffering from a lack of proportions following the implementation of this change.
It can be seen in the image-geometry-test files that you have uploaded whereby each column of the table has one character per line. Tables in this file are specified using % widths, is there perhaps a conflict between using px values for images and % values for tables now?
If you want a separate issue ticket raised for this I can do so - unsure how best to proceed with handling this issue as it directly relates to the change for the image sizing here.
When testing an input HTML containing an image, we are able to produce a DOCX file however the image size constraints are not observed and a large image displays.
Example:
<img src="./images/logo.jpg" width="200" height="120"/>
In the resulting DOCX I would expect to see the logo.jpg file constrained to the size restrictions detailed, h=200px, h=120px, however this is not the case. If you open the HTML file in a browser, you can see that the image dimensions are applied correctly.
Full HTML Example below: