Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#117 : Geometric form in PowerPoint2007 Writer #545

Merged
merged 1 commit into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/changes/1.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
- ODPresentation Writer
- PowerPoint2007 Reader
- PowerPoint2007 Writer
- Support for Geometric form/AutoShape - [@Progi1984](https://github.com/Progi1984) GH-545
- PowerPoint2007 Writer

## Project Management
- Migrated from Travis CI to Github Actions - [@Progi1984](https://github.com/Progi1984) GH-635
Expand Down
56 changes: 33 additions & 23 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ Documentation.
- Supports hyperlinks and rich-text strings
- Add images with different styles (positioning, rotation, shadow)
- Set printing options (header, footer, page margins, paper size, orientation)
- Output to different file formats: PowerPoint 2007 (.pptx), OpenDocument Presentation (.odp), Serialized Spreadsheet)
- Input from different file formats:
- PowerPoint 97 (.ppt)
- PowerPoint 2007 (.pptx)
- OpenDocument Presentation (.odp)
- Serialized Spreadsheet
- Output to different file formats:
- PowerPoint 2007 (.pptx)
- OpenDocument Presentation (.odp)
- Serialized Spreadsheet
- ... and lots of other things!

## File formats
Expand All @@ -44,7 +52,8 @@ Below are the supported features for each file formats.
| | Custom | | :material-check: | | :material-check: |
| **Slides** | | | :material-check: | | :material-check: |
| | Name | | :material-check: | | |
| **Element Shape** | Image | | :material-check: | | :material-check: |
| **Element Shape** | AutoShape | | | | :material-check: |
| | Image | | :material-check: | | :material-check: |
| | Hyperlink | | :material-check: | | :material-check: |
| | Line | | :material-check: | | :material-check: |
| | MemoryImage | | :material-check: | | :material-check: |
Expand All @@ -64,27 +73,28 @@ Below are the supported features for each file formats.

### Readers

| Features | | HTML | ODP | PDF | PPT | PPTX |
|---------------------------|----------------------|--------|-------|-------|-------|-------|
| **Document** | Mark as final | | | | | :material-check: |
| **Document Properties** | Standard | | :material-check: | | | :material-check: |
| | Custom | | :material-check: | | | :material-check: |
| **Slides** | | | :material-check: | | | :material-check: |
| | Name | | | | | | :material-check: | |
| **Element Shape** | Image | | :material-check: | | :material-check: | :material-check: |
| | Hyperlink | | :material-check: | | :material-check: | :material-check: |
| | RichText | | :material-check: | | :material-check: | :material-check: |
| | Table | | | | | |
| | Text | | :material-check: | | :material-check: | :material-check: |
| **Charts** | Area | | | | | |
| | Bar | | | | | |
| | Bar3D | | | | | |
| | Doughnut | | | | | |
| | Line | | | | | |
| | Pie | | | | | |
| | Pie3D | | | | | |
| | Radar | | | | | |
| | Scatter | | | | | |
| Features | | ODP | PPT | PPTX |
|---------------------------|----------------------|-------|-------|-------|
| **Document** | Mark as final | | | :material-check: |
| **Document Properties** | Standard | :material-check: | | :material-check: |
| | Custom | :material-check: | | :material-check: |
| **Slides** | | :material-check: | | :material-check: |
| | Name | | | |
| **Element Shape** | AutoShape | | | |
| | Image | :material-check: | :material-check: | :material-check: |
| | Hyperlink | :material-check: | :material-check: | :material-check: |
| | RichText | :material-check: | :material-check: | :material-check: |
| | Table | | | |
| | Text | :material-check: | :material-check: | :material-check: |
| **Charts** | Area | | | |
| | Bar | | | |
| | Bar3D | | | |
| | Doughnut | | | |
| | Line | | | |
| | Pie | | | |
| | Pie3D | | | |
| | Radar | | | |
| | Scatter | | | |


## Contributing
Expand Down
31 changes: 31 additions & 0 deletions docs/usage/shapes/autoshape.md
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();
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ nav:
- Layouts: 'usage/slides/layout.md'
- Shapes:
- Introduction: 'usage/shapes/introduction.md'
- AutoShape: 'usage/shapes/autoshape.md'
- Chart: 'usage/shapes/chart.md'
- Comment: 'usage/shapes/comment.md'
- Drawing: 'usage/shapes/drawing.md'
Expand Down
65 changes: 65 additions & 0 deletions samples/Sample_21_AutoShape.php
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';
}
Loading