承接 cleverape/phppowerpoint 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cleverape/phppowerpoint

最新稳定版本:0.2.0

Composer 安装命令:

composer require cleverape/phppowerpoint

包简介

PHPPowerPoint - Read, Create and Write Presentations documents in PHP

README 文档

README

Latest Stable Version Build Status Code Quality Code Coverage Total Downloads License

PHPPowerPoint 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).

PHPPowerPoint is an open source project licensed under the terms of LGPL version 3. PHPPowerPoint is aimed to be a high quality software product by incorporating continuous integration and unit testing. You can learn more about PHPPowerPoint by reading the Developers' Documentation and the API Documentation.

Read more about PHPPowerPoint:

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)
  • Output to different file formats: PowerPoint 2007 (.pptx), OpenDocument Presentation (.odp), Serialized Presentation)
  • ... and lots of other things!

Requirements

PHPPowerPoint requires the following:

Installation

It is recommended that you install the PHPPowerPoint library through composer. To do so, add the following lines to your composer.json.

{
    "require": {
       "phpoffice/phppowerpoint": "dev-master"
    }
}

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/PhpPowerpoint/src/PhpPowerpoint/Autoloader.php';
\PhpOffice\PhpPowerpoint\Autoloader::register();

Getting started

The following is a basic usage example of the PHPPowerPoint library.

require_once 'src/PhpPowerpoint/Autoloader.php';
\PhpOffice\PhpPowerpoint\Autoloader::register();

$objPHPPowerPoint = new PhpPowerpoint();

// Create slide
$currentSlide = $objPHPPowerPoint->getActiveSlide();

// Create a shape (drawing)
$shape = $currentSlide->createDrawingShape();
$shape->setName('PHPPowerPoint logo')
      ->setDescription('PHPPowerPoint 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 PHPPowerPoint!');
$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 PHPPowerPoint. Below are some of the things that you can do to contribute:

统计信息

  • 总下载量: 453
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 537
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL
  • 更新时间: 2014-12-04