PHPExcel PDF creation issues

Nov 29, 2011 at 9:01 AM

Hey. I'm trying to export some data from mySQL to PDF . I have some problems with which i could use some help..

Firstly, i read alot of these discussions and Issues included in Issue Tracker. I still have problems with the outside border that appears out of nothing around the worksheet and prolongs itself through the pages (if i have 2 pages of data the border actually doesn't close itself on the bottom side ...so that it can continue on the next page ). Can this be removed someway? (setting ->allborders  affects the outside border too? if that so i can change it to white and problem solved..for the pdf output)

Secondly...that becomes more remarcable when i try to export data to A3 Landscape format.

this is the code

    $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
    $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3);

Now the table retains the A4 format and it's natural "beautifull" exterior border and remains in PORTRAIT A4 while the pdf document changes to A3 Landscape.

So i have A3 Land doc with A4 Port data in it. How can i set the worksheet's Setup...Or didn't i read enough docs, but i don't remember finding anything at all about this in the provided material (documentation).

 

Thirdly : $objPHPExcel->getActiveSheet()->getPageMargins()->set * works for Left Bottom and Top....setRight doesn't seem to have any effect whatsoever....only modification visible is through the movement of the left margin to the ...left...that pulling all the data cells and the right margin along with it.

 

Hope that others hit these issues and can help me solve them.

Nov 29, 2011 at 1:06 PM

I would suggest, rather than use PHPExcel to make your PDF, output to HTML and convert the HTML to a PDF with mPDF instead: http://www.mpdf1.com/mpdf/

Nov 30, 2011 at 4:57 AM
Edited Nov 30, 2011 at 7:36 AM

That could be usefull. But oes it solve all my 3 issues? :) never worked with mPDF before so i'm expecting some advice please.

 

Edited: If only i could get rid of those lines...using something like allBorders() would help? I can paint them white and arrange my content so that it would be perfect but...dunno how to acces and change properties for the A4 frame and for the overall page frame...

http://i.imgur.com/kvFBQ.jpg

 

Edit.2 Got that black thick border fixed...by using $objPHPExcel->getActiveSheet()->getStyle('A1')->getBorders()->getAllBorders()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE);

incredible but worked...now i would really really like to get rid of the "all spreadsheet protecting" frame...if possible..