public function postFinalpresentation()
 {
     $id_result = Input::get('id_result');
     $resulted = AutomateModel::where('id', $id_result)->first();
     //        $range_name_id = Input::get('range_name_id');
     $result = LogChartModel::where('id_result', $id_result)->get();
     $objPHPPowerPoint = new PhpPowerpoint();
     // Set properties
     //        echo date('H:i:s') . ' Set properties' . EOL;
     $objPHPPowerPoint->getProperties()->setCreator('HAT Developer')->setLastModifiedBy('HAT Developer')->setTitle('Sample 07 Title')->setSubject('Sample 07 Subject')->setDescription('Sample 07 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category');
     // Remove first slide
     //        echo date('H:i:s') . ' Remove first slide' . EOL;
     $objPHPPowerPoint->removeSlideByIndex(0);
     // Set Style
     $oFill = new Fill();
     //        $oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20'));
     $oShadow = new Shadow();
     $oShadow->setVisible(true)->setDirection(45)->setDistance(10);
     //FIRST SLIDE
     $currentSlide = $this->createTemplatedSlide($objPHPPowerPoint);
     // local function
     // Create a shape (text)
     // Create a shape (text)
     $shape = $currentSlide->createRichTextShape();
     $shape->setHeight(600)->setWidth(930)->setOffsetX(40)->setOffsetY(300);
     $shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT)->setMarginLeft(25)->setIndent(-25);
     $shape->getActiveParagraph()->getFont()->setSize(18)->setColor(new Color('E07116'));
     //        $shape->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET);
     $shape->createTextRun($resulted->info);
     //END OF FIRST SLIDE
     $index = 0;
     //        print_r('here'); exit();
     foreach ($result as $file) {
         //            echo $file->filename.'<br>';
         $currentSlide = $this->createTemplatedSlide($objPHPPowerPoint);
         $shape = $currentSlide->createDrawingShape();
         $shape->setName('Result Chart')->setDescription('PHPPowerPoint logo')->setPath(public_path($file->filename))->setHeight(450)->setWidth(650)->setOffsetX(100)->setOffsetY(160);
         $shape->getShadow()->setVisible(true)->setDirection(45)->setDistance(10);
         $shape = $currentSlide->createRichTextShape();
         $shape->setHeight(50)->setWidth(930)->setOffsetX(20)->setOffsetY(45);
         $shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER)->setMarginLeft(25)->setIndent(-25);
         $shape->getActiveParagraph()->getFont()->setSize(23)->setColor(new Color('D66204'));
         //        $shape->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET);
         $title = explode(',', $file->title);
         $plot_data = PlotDataModel::where('id_plot', $file->id_plot)->get();
         $plot_name = PlotModel::where('id', $file->id_plot)->first();
         $technya = TechnologyModel::where('id', $plot_name->id_tech)->first();
         if ($technya->name == 'UMTS') {
             $shape->createTextRun(str_ireplace('ch', 'UARFCN', $title[1]) . ' Histogram');
         } else {
             if ($technya->name == 'LTE') {
                 $shape->createTextRun(str_ireplace('ch', 'LARFCN', $title[1]) . ' Histogram');
             } else {
                 $shape->createTextRun(str_ireplace('ch', 'ARFCN', $title[1]) . ' Histogram');
             }
         }
         $co = count($plot_data);
         $shape = $currentSlide->createTableShape(1);
         $shape->setWidth(150);
         $shape->setOffsetX(760);
         $shape->setOffsetY(200);
         $row = $shape->createRow();
         $row->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('EEF0EB'))->setEndColor(new Color('EEF0EB'));
         $row->nextCell()->createTextRun($plot_name->name);
         $i = 2;
         foreach ($plot_data as $rw) {
             $row = $shape->createRow();
             if ($i % 2 == 0) {
                 $row->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('DCEBCA'))->setEndColor(new Color('DCEBCA'));
             } else {
                 $row->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('EEF0EB'))->setEndColor(new Color('EEF0EB'));
             }
             $row->nextCell()->createTextRun($rw->start . ' to ' . $rw->end);
             $i++;
         }
         $index++;
     }
     // Save file
     $named = date('Ymdhis_') . $this->toAscii($resulted->info);
     $this->write($objPHPPowerPoint, $named, $this->writers);
     $resultsave = AutomateModel::find($id_result);
     $resultsave->file_result = date('Y-m-d') . '/' . $named;
     $resultsave->save();
     Session::flash('message', SiteHelpers::alert('success', Lang::get('Process has completed, check the result on table bellow')));
     return Redirect::to('/automate');
 }
use PhpOffice\PhpPowerpoint\Style\Fill;
use PhpOffice\PhpPowerpoint\Style\Shadow;
// Create new PHPPowerPoint object
echo date('H:i:s') . ' Create new PHPPowerPoint object' . EOL;
$objPHPPowerPoint = new PhpPowerpoint();
// Set properties
echo date('H:i:s') . ' Set properties' . EOL;
$objPHPPowerPoint->getProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPowerPoint Team')->setTitle('Sample 07 Title')->setSubject('Sample 07 Subject')->setDescription('Sample 07 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category');
// Remove first slide
echo date('H:i:s') . ' Remove first slide' . EOL;
$objPHPPowerPoint->removeSlideByIndex(0);
// Set Style
$oFill = new Fill();
$oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20'));
$oShadow = new Shadow();
$oShadow->setVisible(true)->setDirection(45)->setDistance(10);
// Generate sample data for chart
echo date('H:i:s') . ' Generate sample data for chart' . EOL;
$seriesData = array('Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7);
// Create templated slide
echo EOL . date('H:i:s') . ' Create templated slide' . EOL;
$currentSlide = createTemplatedSlide($objPHPPowerPoint);
// Create a line chart (that should be inserted in a shape)
echo date('H:i:s') . ' Create a line chart (that should be inserted in a chart shape)' . EOL;
$lineChart = new Line();
$series = new Series('Downloads', $seriesData);
$series->setShowSeriesName(true);
$series->setShowValue(true);
$lineChart->addSeries($series);
// Create a shape (chart)
echo date('H:i:s') . ' Create a shape (chart)' . EOL;
Example #3
0
 /**
  * Test get/set visible
  */
 public function testSetIsVisible()
 {
     $object = new Shadow();
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setVisible());
     $this->assertFalse($object->isVisible());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setVisible(false));
     $this->assertFalse($object->isVisible());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Shadow', $object->setVisible(true));
     $this->assertTrue($object->isVisible());
 }