twilroad/presentation
Composer 安装命令:
composer require twilroad/presentation
包简介
PHPPresentation - Read, Create and Write Presentations documents in PHP
README 文档
README
Branch Master :
Branch Develop :
PHPPresentation is a library written in pure PHP that provides a set of classes to write to different presentation file formats, i.e. Microsoft Office Open XML (OOXML or OpenXML) or OASIS Open Document Format for Office Applications (OpenDocument or ODF).
PHPPresentation is an open source project licensed under the terms of LGPL version 3. PHPPresentation is aimed to be a high quality software product by incorporating continuous integration and unit testing. You can learn more about PHPPresentation by reading the Developers' Documentation and the API Documentation.
Read more about PHPPresentation:
- Features
- Requirements
- Installation
- Getting started
- Contributing
- Developers' Documentation
- API Documentation
Features
- Create an in-memory presentation representation
- Set presentation meta data (author, title, description, etc)
- Add slides from scratch or from existing one
- Supports different fonts and font styles
- Supports different formatting, styles, fills, gradients
- Supports hyperlinks and rich-text strings
- Add images with different styles (positioning, rotation, shadow)
- Set printing options (header, footer, page margins, paper size, orientation)
- Set transitions between slides
- Output to different file formats: PowerPoint 2007 (.pptx), OpenDocument Presentation (.odp), Serialized Presentation)
- ... and lots of other things!
Requirements
PHPPresentation requires the following:
- PHP 5.3+
- Zip extension
- XML Parser extension
- XMLWriter extension (optional, used to write DOCX and ODT)
- GD
Installation
Composer method
It is recommended that you install the PHPPresentation library through composer. To do so, add
the following lines to your composer.json.
{
"require": {
"phpoffice/phppresentation": "dev-master"
}
}
Manual download method
Alternatively, you can download the latest release from the releases page. In this case, you will have to register the autoloader. (Register autoloading is required only if you do not use composer in your project.)
require_once 'path/to/PhpPresentation/src/PhpPresentation/Autoloader.php'; \PhpOffice\PhpPresentation\Autoloader::register();
You will also need to download the latest PHPOffice/Common release from its releases page. And you will also have to register its autoloader, too.
require_once 'path/to/PhpOffice/Common/src/Common/Autoloader.php'; \PhpOffice\Common\Autoloader::register();
Getting started
The following is a basic usage example of the PHPPresentation library.
// with your own install require_once 'src/PhpPresentation/Autoloader.php'; \PhpOffice\PhpPresentation\Autoloader::register(); require_once 'src/Common/Autoloader.php'; \PhpOffice\Common\Autoloader::register(); // with Composer require_once 'vendor/autoload.php'; use PhpOffice\PhpPresentation\PhpPresentation; use PhpOffice\PhpPresentation\IOFactory; use PhpOffice\PhpPresentation\Style\Color; use PhpOffice\PhpPresentation\Style\Alignment; $objPHPPowerPoint = new PhpPresentation(); // Create slide $currentSlide = $objPHPPowerPoint->getActiveSlide(); // Create a shape (drawing) $shape = $currentSlide->createDrawingShape(); $shape->setName('PHPPresentation logo') ->setDescription('PHPPresentation logo') ->setPath('./resources/phppowerpoint_logo.gif') ->setHeight(36) ->setOffsetX(10) ->setOffsetY(10); $shape->getShadow()->setVisible(true) ->setDirection(45) ->setDistance(10); // Create a shape (text) $shape = $currentSlide->createRichTextShape() ->setHeight(300) ->setWidth(600) ->setOffsetX(170) ->setOffsetY(180); $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' ) ); $oWriterPPTX = IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007'); $oWriterPPTX->save(__DIR__ . "/sample.pptx"); $oWriterODP = IOFactory::createWriter($objPHPPowerPoint, 'ODPresentation'); $oWriterODP->save(__DIR__ . "/sample.odp");
More examples are provided in the samples folder. You can also read the Developers' Documentation and the API Documentation for more detail.
Contributing
We welcome everyone to contribute to PHPPresentation. Below are some of the things that you can do to contribute:
- Read our contributing guide
- Fork us and request a pull to the develop branch
- Submit bug reports or feature requests to GitHub
- Follow @PHPOffice on Twitter
twilroad/presentation 适用场景与选型建议
twilroad/presentation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 03 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「pptx」 「PowerPoint」 「LibreOffice」 「ppt」 「odp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 twilroad/presentation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 twilroad/presentation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 twilroad/presentation 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHPPresentation - Read, Create and Write Presentations documents in PHP
A client for sending files to a Gotenberg API
PHP library for extracting and replacing string data in .pptx files.
Aspose.Slides for PHP via Java is a PowerPoint PHP API for creating, manipulating, and managing presentations. It allows applications and developers to read, write, convert, and manipulate PowerPoint presentations in PHP.
PHPPowerPoint - Read, Create and Write Presentations documents in PHP
A client for sending files to a Gotenberg API
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-only
- 更新时间: 2019-03-26