This project is read-only.

Creating Tables in PHPPowerpoint

Oct 13, 2010 at 10:53 AM

Hi All,

Has anyone implemented any code to create tables in PHPPowerpoint? I am thinking about writing this functionality myself but if someone has already started or completed it that would obviously be better.

Best regards


Oct 13, 2010 at 12:36 PM

Check the latest sources on
Basic tables are supported (see Tests folder)

Oct 13, 2010 at 12:39 PM
Edited Oct 13, 2010 at 2:53 PM

Thanks Maartenba,

I can’t believe I missed this!

Thanks so much for the code it is a work of pure genius,

Best regards


Oct 13, 2010 at 2:57 PM

Hi Maartenba,

Is it possible to change Bar Chart Series colors? I can't seem to find the right place to put the Fill information

best regards


Oct 13, 2010 at 4:41 PM

PHPPowerPoint_Shape_Chart_Series has a getFill() method, so you can do this:

$series = new PHPPowerPoint_Shape_Chart_Series('2009', $series1Data);
$bar3DChart->addSeries( $series );

Oct 13, 2010 at 4:45 PM

Thanks Maartenba, I knew it would be simple and I was having a moment.

I have added a non 3D BAR chart which I am very happy about, although swapping  c:bar3DChart to c:barChart may not be considered difficult for you!

Best regards


Oct 14, 2010 at 6:34 AM

Care to share that code?

Oct 14, 2010 at 9:52 AM
Edited Oct 14, 2010 at 9:54 AM


1) First I copied the Bar3D.php file (PHPPowerpoint/Shape/Chart/Type/) and pasted/created Bar.php

2) Changed Class name in Bar.php to 'PHPPowerPoint_Shape_Chart_Type_Bar'

3) In Chart.php (PHPPowerpoint/Writer/PowerPoint2007/Chart) I copied the method '_writeTypeBar3D' and created a new method '_writeTypeBar'

4) I changed '$objWriter->startElement('c:bar3DChart');' to '$objWriter->startElement('c:barChart');' in the '_writeTypeBar' method


can now create bar charts with:

$barChart = new PHPPowerPoint_Shape_Chart_Type_Bar();
$series = $barChart->addSeries( new PHPPowerPoint_Shape_Chart_Series('', $series1Data));

Best regards,