How to remove table borders/shading when using PDF writer?

Mar 11, 2011 at 7:42 PM

PHPExcel 1.7.6

PHP 5.2.9

Output created with PDF writer has lots of big cell borders or backgrounds that I haven't set. Is there a way to output PDF's without the table layout?

I'm saving all my content to an array, which is then fed into the PHPExcel object by row.

Oct 10, 2011 at 10:25 AM

PHPExcel 1.7.6

PHP 5.3.8

I'm having the same problem.

Any ideas?

Oct 10, 2011 at 12:51 PM

I get around this by just using mPDF instead for PDFs -- create the HTML, and send it to mPDF.

Apr 1, 2012 at 12:51 PM
Edited Apr 1, 2012 at 12:52 PM


same problem here.

I have modified file ../PHPExcel/Writer/PDF.php after having fetched HTML content in PDF::save() like so:

$map = array(
	'/font-weight:bold;/i' => '', // remove inline CSS bold fonts
	'/font-size:(\d+)pt/i' => 'font-size:9px', // hard coded font size
	'/cellspacing="(\d+)"/i' => 'cellspacing="2"', // less cell spacing, makes 4
$html = preg_replace(array_keys($map), array_values($map), $html);


It seems to me, the only way to fix this, is forcibly set border to e.g. DASHED, DOTTED, HAIR, etc - but if you set BORDER_NONE it is not working.


Same issue with saving into HTML - default empty cells will always have dotted borders rather than leaving it empty.