Skip to content

Commit

Permalink
PHPOffice#179 : Bugfix for printing slide notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Mar 18, 2016
1 parent b86b0c2 commit 226a490
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions samples/Sample_09_SlideNote.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,51 @@
// Create new PHPPresentation object
echo date('H:i:s') . ' Create new PHPPresentation object' . EOL;
$objPHPPresentation = new PhpPresentation();
$oLayout = $objPHPPresentation->getLayout();

// Set properties
echo date('H:i:s') . ' Set properties' . EOL;
$objPHPPresentation->getProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPresentation Team')->setTitle('Sample 01 Title')->setSubject('Sample 01 Subject')->setDescription('Sample 01 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category');
$objPHPPresentation->getDocumentProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPresentation Team')->setTitle('Sample 01 Title')->setSubject('Sample 01 Subject')->setDescription('Sample 01 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category');

// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
$currentSlide = $objPHPPresentation->getActiveSlide();

// Create a shape (drawing)
echo date('H:i:s') . ' Create a shape (drawing)'.EOL;
echo date('H:i:s') . ' Create a shape (drawing)' . EOL;
$shape = $currentSlide->createDrawingShape();
$shape->setName('PHPPresentation logo')
->setDescription('PHPPresentation logo')
->setPath('./resources/phppowerpoint_logo.gif')
->setHeight(36)
->setOffsetX(10)
->setOffsetY(10);
->setDescription('PHPPresentation logo')
->setPath('./resources/phppowerpoint_logo.gif')
->setHeight(36)
->setOffsetX(10)
->setOffsetY(10);
$shape->getShadow()->setVisible(true)
->setDirection(45)
->setDistance(10);
->setDirection(45)
->setDistance(10);
$shape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation');

// Create a shape (text)
echo date('H:i:s') . ' Create a shape (rich text)'.EOL;
echo date('H:i:s') . ' Create a shape (rich text)' . EOL;
$shape = $currentSlide->createRichTextShape()
->setHeight(300)
->setWidth(600)
->setOffsetX(170)
->setOffsetY(180);
$shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER );
$shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$textRun = $shape->createTextRun('Thank you for using PHPPresentation!');
$textRun->getFont()->setBold(true)
->setSize(60)
->setColor( new Color( 'FFE06B20' ) );
->setSize(60)
->setColor(new Color('FFE06B20'));

// Set Note
echo date('H:i:s') . ' Set Note' . EOL;
$oNote = $currentSlide->getNote();
$oRichText = $oNote->createRichTextShape()->setHeight(300)->setWidth(600)->setOffsetX(170)->setOffsetY(180);;
$oRichText = $oNote->createRichTextShape()
->setHeight($oLayout->getCY($oLayout::UNIT_PIXEL))
->setWidth($oLayout->getCX($oLayout::UNIT_PIXEL))
->setOffsetX(170)
->setOffsetY(180);;
$oRichText->createTextRun('A class library');
$oRichText->createParagraph()->createTextRun('Written in PHP');
$oRichText->createParagraph()->createTextRun('Representing a presentation');
Expand All @@ -59,5 +64,5 @@
// Save file
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
include_once 'Sample_Footer.php';
}

0 comments on commit 226a490

Please sign in to comment.