Esempio n. 1
0
 /**
  * Test get/set fill type
  */
 public function testSetGetFillType()
 {
     $object = new Fill();
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->setFillType());
     $this->assertEquals(Fill::FILL_NONE, $object->getFillType());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->setFillType(Fill::FILL_GRADIENT_LINEAR));
     $this->assertEquals(Fill::FILL_GRADIENT_LINEAR, $object->getFillType());
 }
Esempio n. 2
0
    $shape->getView3D()->setPerspective(30);
    $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE);
    $shape->getLegend()->getFont()->setItalic(true);
}
// Create new PHPPresentation object
echo date('H:i:s') . ' Create new PHPPresentation object' . EOL;
$objPHPPresentation = new PhpPresentation();
// Set properties
echo date('H:i:s') . ' Set properties' . EOL;
$objPHPPresentation->getProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPresentation 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;
$objPHPPresentation->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);
fnSlide_Area($objPHPPresentation);
fnSlide_Bar($objPHPPresentation);
fnSlide_BarStacked($objPHPPresentation);
fnSlide_BarPercentStacked($objPHPPresentation);
fnSlide_BarHorizontal($objPHPPresentation);
fnSlide_Bar3D($objPHPPresentation);
fnSlide_Bar3DHorizontal($objPHPPresentation);
fnSlide_Pie3D($objPHPPresentation);
fnSlide_Pie($objPHPPresentation);
fnSlide_Scatter($objPHPPresentation);
// Save file
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
if (!CLI) {
Esempio n. 3
0
 public function testTableCellFill()
 {
     $oColor = new Color();
     $oColor->setRGB(Color::COLOR_BLUE);
     $oFill = new Fill();
     $oFill->setFillType(Fill::FILL_SOLID)->setStartColor($oColor);
     $phpPresentation = new PhpPresentation();
     $oSlide = $phpPresentation->getActiveSlide();
     $oShape = $oSlide->createTableShape();
     $oRow = $oShape->createRow();
     $oCell = $oRow->getCell();
     $oCell->setFill($oFill);
     $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation');
     $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1r0c0\']';
     $this->assertTrue($pres->elementExists($element, 'content.xml'));
     $this->assertEquals('table-cell', $pres->getElementAttribute($element, 'style:family', 'content.xml'));
     $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1r0c0\']/style:graphic-properties';
     $this->assertTrue($pres->elementExists($element, 'content.xml'));
     $this->assertEquals('solid', $pres->getElementAttribute($element, 'draw:fill', 'content.xml'));
     $this->assertStringStartsWith('#', $pres->getElementAttribute($element, 'draw:fill-color', 'content.xml'));
     $this->assertStringEndsWith($oColor->getRGB(), $pres->getElementAttribute($element, 'draw:fill-color', 'content.xml'));
 }