How to set the size of exported images in PHPExcel

Source: Internet
Author: User
When you use PHPExcel to export an image to excel, the image size is displayed only in a certain proportion and cannot be displayed according to your requirements, can someone help me?
$ ObjDrawing = new PHPExcel_Worksheet_Drawing ();
$ ObjDrawing-> setName ('photo ');
$ ObjDrawing-> setDescription ('image inserted by pyxjm ');
$ ObjDrawing-> setPath ('.'. $ data ['lic _ litpic ']);
$ ObjDrawing-> setWidth ('122pt ');
$ ObjDrawing-> setHeight ('200pt ');
$ ObjDrawing-> setCoordinates ('G2 ');
$ ObjDrawing-> setOffsetX (2 );
$ ObjDrawing-> getShadow ()-> setVisible (true );
// $ ObjDrawing-> setMimeType (PHPExcel_Worksheet_MemoryDrawing: MIMETYPE_DEFAULT );
$ ObjDrawing-> setWorksheet ($ objPHPExcel-> getActiveSheet ());


Reply to discussion (solution)

$ ObjDrawing-> setHeight (122); // The Photo height.
$ ObjDrawing-> setWidth (200); // The Photo width.

$ ObjDrawing-> setHeight (122); // The Photo height.
$ ObjDrawing-> setWidth (200); // The Photo width.


This cannot be solved on the first floor. I tried it before ....

$ ObjDrawing-> setHeight (122); // The Photo height.
$ ObjDrawing-> setWidth (200); // The Photo width.


No one has answered the problem and I will give it to you.

Reference the reply on the first floor:

$ ObjDrawing-> setHeight (122); // The Photo height.
$ ObjDrawing-> setWidth (200); // The Photo width.

No one has answered the problem and I will give it to you.


After solving the problem, let's talk about the specific process.
If everyone has this kind of dedication
I guess you won't have to ask this question here, will you?

$ ObjDrawing-> setResizeProportional (false );
By default, the image is scaled according to the original image. it can be set to false.
The landlord does not share this information.

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.