Skip to content

Commit 74d0773

Browse files
committed
Merge pull request #206 from Progi1984/issue179
#179 : Bugfix for printing slide notes
2 parents bd75454 + 7725c63 commit 74d0773

File tree

4 files changed

+394
-227
lines changed

4 files changed

+394
-227
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Bugfix
66
- Fixed the image project - @mvargasmoran GH-177
7+
- PowerPoint2007 Writer : Bugfix for printing slide notes - @JewrassicPark @Progi1984 GH-179
78

89
### Changes
910
- PhpOffice\PhpPresentation\Writer\ODPresentation : Move to Design Pattern Decorator - @Progi1984

samples/Sample_09_SlideNote.php

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,51 @@
1111
// Create new PHPPresentation object
1212
echo date('H:i:s') . ' Create new PHPPresentation object' . EOL;
1313
$objPHPPresentation = new PhpPresentation();
14+
$oLayout = $objPHPPresentation->getLayout();
1415

1516
// Set properties
1617
echo date('H:i:s') . ' Set properties' . EOL;
17-
$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');
18+
$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');
1819

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

2324
// Create a shape (drawing)
24-
echo date('H:i:s') . ' Create a shape (drawing)'.EOL;
25+
echo date('H:i:s') . ' Create a shape (drawing)' . EOL;
2526
$shape = $currentSlide->createDrawingShape();
2627
$shape->setName('PHPPresentation logo')
27-
->setDescription('PHPPresentation logo')
28-
->setPath('./resources/phppowerpoint_logo.gif')
29-
->setHeight(36)
30-
->setOffsetX(10)
31-
->setOffsetY(10);
28+
->setDescription('PHPPresentation logo')
29+
->setPath('./resources/phppowerpoint_logo.gif')
30+
->setHeight(36)
31+
->setOffsetX(10)
32+
->setOffsetY(10);
3233
$shape->getShadow()->setVisible(true)
33-
->setDirection(45)
34-
->setDistance(10);
34+
->setDirection(45)
35+
->setDistance(10);
3536
$shape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation');
3637

3738
// Create a shape (text)
38-
echo date('H:i:s') . ' Create a shape (rich text)'.EOL;
39+
echo date('H:i:s') . ' Create a shape (rich text)' . EOL;
3940
$shape = $currentSlide->createRichTextShape()
4041
->setHeight(300)
4142
->setWidth(600)
4243
->setOffsetX(170)
4344
->setOffsetY(180);
44-
$shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER );
45+
$shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
4546
$textRun = $shape->createTextRun('Thank you for using PHPPresentation!');
4647
$textRun->getFont()->setBold(true)
47-
->setSize(60)
48-
->setColor( new Color( 'FFE06B20' ) );
48+
->setSize(60)
49+
->setColor(new Color('FFE06B20'));
4950

5051
// Set Note
5152
echo date('H:i:s') . ' Set Note' . EOL;
5253
$oNote = $currentSlide->getNote();
53-
$oRichText = $oNote->createRichTextShape()->setHeight(300)->setWidth(600)->setOffsetX(170)->setOffsetY(180);;
54+
$oRichText = $oNote->createRichTextShape()
55+
->setHeight($oLayout->getCY($oLayout::UNIT_PIXEL))
56+
->setWidth($oLayout->getCX($oLayout::UNIT_PIXEL))
57+
->setOffsetX(170)
58+
->setOffsetY(180);
5459
$oRichText->createTextRun('A class library');
5560
$oRichText->createParagraph()->createTextRun('Written in PHP');
5661
$oRichText->createParagraph()->createTextRun('Representing a presentation');
@@ -59,5 +64,5 @@
5964
// Save file
6065
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
6166
if (!CLI) {
62-
include_once 'Sample_Footer.php';
67+
include_once 'Sample_Footer.php';
6368
}

0 commit comments

Comments
 (0)