如何用php Excel生成漂亮的PDF? [英] How to generate a nice PDF with php Excel?
问题描述
我正在使用最新的PHPExcel版本(我认为是7.7).我能够产生自己的优势.我必须用tcpdf生成pdf版本,在这里别无选择.
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.
请参阅2012-000012的巨大字体,在excel中为11.
See the gigantic font-size for 2012-000012, is 11 in excel.
如您所见,这里有2个问题.文档过大,边框不整齐.
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);
这:
$this->printer->getActiveSheet()->getPageSetup()->setScale(50);
比例尺设置为50,但不影响输出.那我该如何摆脱这两个问题呢?
The scale is set to 50, but it do not affect output. So how can i get rid of these 2 problems ?
这是我的excel屏幕,如何设置自动换行符PhpExcel?.
Here is a screen, of my excel How to set auto-line break PhpExcel? .
更新:
通过将cellpacing设置为0个边框,几乎可以按预期处理,这仍然是sligth问题,可能是由过大的问题引起的.
By setting cellspacing to 0 borders are handled almost as expected, still a sligth problem, maybe caused by the oversized problem.
请参阅:
是否存在将其设置为0的opion或方法调用?
Is there an opion or a method call to set it to 0 ?
由于我没有显示网格线,所以它位于writer \ html.php第915行中.
This lies in the writer\html.php line 915, since i don't display gridlines.
推荐答案
要删除您发现令人讨厌的边框,请关闭要在pdf中呈现的每张图纸上的网格线.
To remove the borders that you find objectionable turn off grid lines on each sheet that you want to render in your the pdf.
例如: $ objPHPExcel-> getActiveSheet()->-> setShowGridlines(false);
For example: $objPHPExcel->getActiveSheet()->->setShowGridlines(false);
这篇关于如何用php Excel生成漂亮的PDF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!