About exporting WORD with pictures in PHP

Source: Internet
Author: User
Tags phpword
How to export a WORD image with PHP:
1. MhtFileMaker. php class. use MHT to convert DOC. The image is blank and has no size. (The format is not what I want)
2. the phpWord class is exported using addImages, and the image size is also blank. The exported DOC file is KB, which is equivalent to storing the size and capacity attributes. why cannot this attribute be displayed ?!
3. COM component. Although everyone said it was a stupid method, the loading of the guy was too slow and basically failed. (The browser always reads the status)

++
In this solution, only images in the format are exported using PHP.
Thank you !!


Reply to discussion (solution)

I have never touched on it. if not, can I export a PDF?

I suspect that your image is blank.

I have never touched on it. if not, can I export a PDF?
Currently, only WORD is supported, mainly because the image cannot be displayed.


I suspect that your image is blank.
+++ The image is really not blank, and I have tried it whether it is a relative path or an absolute path. I am talking about base64 encoding on the Internet, but I use the IMAGE case of PHPWORD, which does not show any images. I am thinking about whether PHP is not fully configured. However, the GD library is available.

Does phpWord only support word2007?

Does phpWord only support word2007?
++ Yes, I have WORD2007 installed, and docx is also open.
Now the problem is very strange. you can set the text size and style, operate the table, or add an image (only the style and size are allowed), that is, do not display the image.
You can also export data to the docx format.

I don't have word2007. I usually use wps to open docx files.
The image.docx generated by the phpword sample program image. php cannot be seen by wps.

However, opening image.docx with winrar does show the inserted image in the word/media directory.
The docx document generated by phpword is incorrect.

Since you have word2007, you can manually generate files with the same content, and then compare the differences between the two.

I don't have word2007. I usually use wps to open docx files.
The image.docx generated by the phpword sample program image. php cannot be seen by wps.

++++ !!!, I used MSWORD2007 all the time. This computer is WPS. Solved!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.