问题
I'm using the last PHPExcel version (7.7 i think). I'm able to generate my excel. I have to generate the pdf version with tcpdf, no choice here.
But the result is ugly and oversized.

See the gigantic font-size for 2012-000012, is 11 in excel.
As you can see, there is 2 problems here. The document is oversized, and the borders are crappy.
In order to get rid of the oversized side, i tryied this :
$this->printer->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
And this :
$this->printer->getActiveSheet()->getPageSetup()->setScale(50);
The scale is set to 50, but it do not affect output. So how can i get rid of these 2 problems ?
Here is a screen, of my excel How to set auto-line break PhpExcel? .
UPDATE :
By setting cellspacing to 0 borders are handled almost as expected, still a sligth problem, maybe caused by the oversized problem.
See :

Is there an opion or a method call to set it to 0 ?
This lies in the writer\html.php line 915, since i don't display gridlines.
回答1:
To remove the borders that you find objectionable turn off grid lines on each sheet that you want to render in your the pdf.
For example: $objPHPExcel->getActiveSheet()->->setShowGridlines(false);
回答2:
to solve this problem I do two operations.
Step one is to set orientation for PHPexcel object
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
Step two - set different paper size for PHPExcel object:
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A2_PAPER);
Then convert PHPExcel object to object writer
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
$objWriter->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
$objWriter->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A2_PAPER);
This works for me. Also i changed font size inside PHPExcel object - just like this for headers
$objPHPExcel->setActiveSheetIndex($lastsheet)->getStyle("A1:K3")->applyFromArray(
array(
'font' => array(
'size' => 8
)
)
);
and for the rest of data:
$objPHPExcel->getDefaultStyle()->getFont()->setName('Arial')->setSize(8);
Now im trying to get of ugly borders that tcPDF generates and one additional row at the end of file...
来源:https://stackoverflow.com/questions/13088793/how-to-generate-a-nice-pdf-with-php-excel