Image distortion/print area error

Topics: Developer Forum
May 9, 2014 at 9:34 AM
Edited May 29, 2014 at 8:44 AM
Hello, my company currently uses PHPExcel(Excel 5 writer) with a leaflet generator. Our client is able to input images from a database into the leaflet, and it is exported as an Excel file(there is a base template file, image and text are added to the template using PHPExcel). We have tried multiple versions of PHPExcel and have not been able to perfect the final appearance.We are currently using version 1.7.6.

Image

Originally, the images in the final file were distorted horizontally(see image). I found that this problem was solved by changing the default font and size with the following line of code(this particular font and size prevented the images from distorting).
$objPHPExcel->getDefaultStyle()->getFont()->setName('Calibri')->setSize(11);
The images were then output without any horizontal distortion, as in the next image.

Image

However, using the line of code above, it has caused problems with the print area of the file. While images are no longer stretched, there is now an issue with the print area. In the below image, the print area has expanded and caused the print area to expand into a second page. In other cases, the print area has been narrowed, adding white space to the right margin.

Image

Image

I would like to be able to have the images added to the graph without distortion, but also without causing any changes to the print area. How is this possible?
Jun 14, 2014 at 9:58 AM
Edited Jun 14, 2014 at 9:59 AM
Hello, I have also been having the same issues with PHPExcel. Have you
tried the solutions in this thread?

https://phpexcel.codeplex.com/discussions/63144
Jun 30, 2014 at 8:33 AM
I have looked at the solutions in that thread, but there was nothing about the print area problem. Please let me know if you have found a solution.
Jul 15, 2014 at 1:06 PM
Hello minitank,

Have you been able to get it to work by resetting the print area once
you have drawn the images?
Aug 23, 2014 at 2:57 AM
Resetting the print area didn't work for me. I tried looking again and I found this post.

http://stackoverflow.com/questions/12361627/phpexcel-export-xlsx-with-drawing-got-bug-in-width-and-height
http://phpexcel.codeplex.com/discussions/394404

It looks like Doan Cuong and Mark Baker fixed the problem by changing the code in Drawing.php.

I'm using an earlier version of PHPExcel, but do you think changing my Drawing.php with the code in this post will fix the problem?