-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using addHtml function, the width of the image is not measured in pt #2589
Comments
4 tasks
@xfstu Could you test the fix and tell me if it is ok ? |
@xfstu This issue has been fixed by a maintainer. You can help him by sponsoring him through Github sponsors. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the Bug
Hi, hello. When I tried to convert HTML to docx, I found that the width of the image was not the expected width. So, I decompressed the docx and opened document.xml. I found that the width of the image is pixels (px), which makes the document see different image widths when opened on computers with different resolutions. So I tried to search for documents and the internet, but only saw that the unit of image width written in the development document was pt. So I looked up the source code of PHPWord and found that in
PhpOffice\PhpWord\Shared\Html
, the units for width and height in lines 903 and 909 are UNIT-PX. Why is it that the unit in the source code is UNIT-PX instead of UNIT-PT (as stated in the development documentation, the unit is pt)? Is there any other consideration for writing this way? Or can this be considered a bug?Also, I would like to know how to set the width of an image to the width of A4 paper. My English level is not very good. Thank you for taking the time to read my question. Thank you very much for your help!
Steps to Reproduce
php
Expected Behavior
Expected: The width of the image is 449.25pt.
Current Behavior
The content of document.xml:
<v:shape type="#_x0000_t75" stroked="f" style="width:904px; height:574px;...
I omitted some of the code, and what is expected here is "<v: shape type=" # _x0000_t75 "stroke=" f "style=" width: 449.25pt; "; Height: 574pt “
Context
Please fill in your environment information:
The text was updated successfully, but these errors were encountered: