// local function // Generate sample data for first chart echo date('H:i:s') . " Generate sample data for first chart\n"; $series1Data = array('Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293); $series2Data = array('Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379); // Create a bar chart (that should be inserted in a shape) echo date('H:i:s') . " Create a bar chart (that should be inserted in a chart shape)\n"; $bar3DChart = new PHPPowerPoint_Shape_Chart_Type_Bar3D(); $series1 = new PHPPowerPoint_Shape_Chart_Series('2009', $series1Data); $series1->setShowSeriesName(true); $series1->getFont()->getColor()->setRGB('00FF00'); $series1->getDataPointFill(2)->setFillType(PHPPowerPoint_Style_Fill::FILL_SOLID)->setStartColor(new PHPPowerPoint_Style_Color('FF00FF00')); $series2 = new PHPPowerPoint_Shape_Chart_Series('2010', $series2Data); $series2->setShowSeriesName(true); $series2->getFont()->getColor()->setRGB('FF0000'); $bar3DChart->addSeries($series1); $bar3DChart->addSeries($series2); // Create a shape (chart) echo date('H:i:s') . " Create a shape (chart)\n"; $shape = $currentSlide->createChartShape(); $shape->setName('PHPPowerPoint Monthly Downloads')->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $shape->getShadow()->setVisible(true)->setDirection(45)->setDistance(10); $shape->getFill()->setFillType(PHPPowerPoint_Style_Fill::FILL_GRADIENT_LINEAR)->setStartColor(new PHPPowerPoint_Style_Color('FFCCCCCC'))->setEndColor(new PHPPowerPoint_Style_Color('FFFFFFFF'))->setRotation(270); $shape->getBorder()->setLineStyle(PHPPowerPoint_Style_Border::LINE_SINGLE); $shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getTitle()->getAlignment()->setHorizontal(PHPPowerPoint_Style_Alignment::HORIZONTAL_RIGHT); $shape->getPlotArea()->getAxisX()->setTitle('Month'); $shape->getPlotArea()->getAxisY()->setTitle('Downloads'); $shape->getPlotArea()->setType($bar3DChart); $shape->getView3D()->setRightAngleAxes(true);
$objPHPPowerPoint->getProperties()->setCreator("Maarten Balliauw")->setLastModifiedBy("Maarten Balliauw")->setTitle("Office 2007 PPTX Test Document")->setSubject("Office 2007 PPTX Test Document")->setDescription("Test document for Office 2007 PPTX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file"); // Remove first slide echo date('H:i:s') . " Remove first slide\n"; $objPHPPowerPoint->removeSlideByIndex(0); // Create templated slide echo date('H:i:s') . " Create templated slide\n"; $currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function // Generate sample data for first chart echo date('H:i:s') . " Generate sample data for first chart\n"; $series1Data = array('Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293); $series2Data = array('Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379); // Create a bar chart (that should be inserted in a shape) echo date('H:i:s') . " Create a bar chart (that should be inserted in a chart shape)\n"; $bar3DChart = new PHPPowerPoint_Shape_Chart_Type_Bar3D(); $bar3DChart->addSeries(new PHPPowerPoint_Shape_Chart_Series('2009', $series1Data)); $bar3DChart->addSeries(new PHPPowerPoint_Shape_Chart_Series('2010', $series2Data)); // Create a shape (chart) echo date('H:i:s') . " Create a shape (chart)\n"; $shape = $currentSlide->createChartShape(); $shape->setName('PHPPowerPoint Monthly Downloads')->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80)->setIncludeSpreadsheet(true); $shape->getShadow()->setVisible(true)->setDirection(45)->setDistance(10); $shape->getFill()->setFillType(PHPPowerPoint_Style_Fill::FILL_GRADIENT_LINEAR)->setStartColor(new PHPPowerPoint_Style_Color('FFCCCCCC'))->setEndColor(new PHPPowerPoint_Style_Color('FFFFFFFF'))->setRotation(270); $shape->getBorder()->setLineStyle(PHPPowerPoint_Style_Border::LINE_SINGLE); $shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getPlotArea()->getAxisX()->setTitle('Month'); $shape->getPlotArea()->getAxisY()->setTitle('Downloads'); $shape->getPlotArea()->setType($bar3DChart); $shape->getView3D()->setRightAngleAxes(true); $shape->getView3D()->setRotationX(20);