-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #545 from Progi1984/issue117
#117 : Geometric form in PowerPoint2007 Writer
- Loading branch information
Showing
9 changed files
with
613 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# AutoShape | ||
|
||
!!! warning | ||
Available only on the PowerPoint2007 Writer | ||
|
||
To create a geometric form, create an object `AutoShape` and add it to slide. | ||
|
||
``` php | ||
<?php | ||
|
||
use PhpOffice\PhpPresentation\Shape\AutoShape; | ||
|
||
$shape = new AutoShape(); | ||
$slide->addShape($shape) | ||
``` | ||
|
||
## Text | ||
|
||
You can define text of the geometric form with `setText` method. | ||
|
||
``` php | ||
<?php | ||
|
||
use PhpOffice\PhpPresentation\Shape\AutoShape; | ||
|
||
$shape = new AutoShape(); | ||
// Define the text | ||
$shape->setText('ABC'); | ||
// Return the text | ||
$shape->getText(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
include_once 'Sample_Header.php'; | ||
|
||
use PhpOffice\PhpPresentation\PhpPresentation; | ||
use PhpOffice\PhpPresentation\Shape\AutoShape; | ||
use PhpOffice\PhpPresentation\Style\Color; | ||
use PhpOffice\PhpPresentation\Style\Fill; | ||
|
||
// 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->getDocumentProperties()->setCreator('PHPOffice') | ||
->setLastModifiedBy('PHPPresentation Team') | ||
->setTitle('Sample 21 AutoShape') | ||
->setSubject('Sample 21 Subject') | ||
->setDescription('Sample 21 Description') | ||
->setKeywords('office 2007 openxml libreoffice odt php') | ||
->setCategory('Sample Category'); | ||
|
||
// Create slide | ||
echo date('H:i:s') . ' Create slide' . EOL; | ||
$currentSlide = $objPHPPresentation->getActiveSlide(); | ||
|
||
$autoShape = new AutoShape(); | ||
$autoShape->setType(AutoShape::TYPE_PENTAGON) | ||
->setText('Step 1') | ||
->setOffsetX(93) | ||
->setOffsetY(30) | ||
->setWidthAndHeight(175, 100); | ||
$autoShape->getOutline() | ||
->setWidth(0) | ||
->getFill() | ||
->setFillType(Fill::FILL_SOLID) | ||
->setStartColor(new Color(Color::COLOR_BLACK)); | ||
$autoShape->getFill() | ||
->setFillType(Fill::FILL_SOLID) | ||
->setStartColor(new Color('804F81BD')); | ||
$currentSlide->addShape($autoShape); | ||
|
||
for ($inc = 1; $inc < 5; ++$inc) { | ||
$autoShape = new AutoShape(); | ||
$autoShape->setType(AutoShape::TYPE_CHEVRON) | ||
->setText('Step ' . ($inc + 1)) | ||
->setOffsetX(93 + $inc * 100) | ||
->setOffsetY(30) | ||
->setWidthAndHeight(175, 100); | ||
$autoShape->getOutline() | ||
->setWidth($inc) | ||
->getFill() | ||
->setFillType(Fill::FILL_SOLID) | ||
->setStartColor(new Color(Color::COLOR_BLACK)); | ||
$autoShape->getFill() | ||
->setFillType(Fill::FILL_SOLID) | ||
->setStartColor(new Color('FF4F81BD')); | ||
$currentSlide->addShape($autoShape); | ||
} | ||
|
||
// Save file | ||
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); | ||
if (!CLI) { | ||
include_once 'Sample_Footer.php'; | ||
} |
Oops, something went wrong.