这里已经下载好了. 各位可以直接同示例代码一起在本站下载. 我已打好包.
点击这里下载示例包. 另外一个官方发原始包带了API文档还有官方的示例程序的也放出来
官方包下载.
说一下感觉吧. 这个类库还可以. 编码很规范. 完全PHP5的风格. 我喜欢的类型. 和 Zend Framework 一样. 处理速度也非常快. 本次只做了简单才测试. 更多高级功能未花时间去玩. 帖一下测试代码吧.
- <?php
- define(‘DS‘, DIRECTORY_SEPARATOR);
- define(‘ROOT‘, dirname(__FILE__) . DS);
- set_include_path(get_include_path() . PATH_SEPARATOR . ROOT . ‘libs‘);
- set_time_limit(0);
- function __autoload($className) {
- include_once(str_replace("_", DS, $className) . ".php");
- }
- $ppp = new PHPPowerPoint();
- $activeSlide = $ppp->getActiveSlide();
- $shape = $activeSlide->createDrawingShape();
- $shape->setName(‘MmClub.net Logo‘);
- $shape->setDescription(‘MmClub.net Logo‘);
- $shape->setPath(ROOT . ‘mmclub.net.jpg‘);
- $shape->setHeight(103);
- $shape->setWidth(339);
- $shape->setOffsetX(10);
- $shape->setOffsetY(10);
- $shape->getShadow()->setVisible(true);
- $shape->getShadow()->setDirection(45);
- $shape->getShadow()->setDistance(10);
- $shape = $activeSlide->createRichTextShape();
- $shape->setHeight(150);
- $shape->setWidth(600);
- $shape->setOffsetX(150);
- $shape->setOffsetY(200);
- $shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_CENTER );
- $shape->getAlignment()->setVertical( PHPPowerPoint_Style_Alignment::VERTICAL_CENTER );
- $textRun = $shape->createTextRun(‘欢迎使用 PHPPowerPoint2007‘);
- $textRun->getFont()->setBold(true);
- $textRun->getFont()->setSize(38);
- $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( ‘FFFF0000‘ ) );
- $shape0 = $activeSlide->createRichTextShape();
- $shape0->setHeight(50);
- $shape0->setWidth(400);
- $shape0->setOffsetX(250);
- $shape0->setOffsetY(400);
- $shape0->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_CENTER );
- $shape0->getAlignment()->setVertical( PHPPowerPoint_Style_Alignment::VERTICAL_CENTER );
- $textRun0 = $shape0->createTextRun(‘http://www.mmclub.net‘);
- $textRun0->getFont()->setSize(26);
- $textRun0->getFont()->setColor( new PHPPowerPoint_Style_Color( ‘FF0000FF‘ ) );
- $shape1 = $activeSlide->createRichTextShape();
- $shape1->setHeight(30);
- $shape1->setWidth(200);
- $shape1->setOffsetX(700);
- $shape1->setOffsetY(500);
- $shape1->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );
- $shape1->getAlignment()->setVertical( PHPPowerPoint_Style_Alignment::VERTICAL_CENTER );
- $textRun1 = $shape1->createTextRun(‘Author: Guya‘);
- $textRun1->getFont()->setSize(14);
- $textRun1->getFont()->setColor( new PHPPowerPoint_Style_Color( ‘FF000000‘ ) );
- $shape2 = $activeSlide->createRichTextShape();
- $shape2->setHeight(30);
- $shape2->setWidth(200);
- $shape2->setOffsetX(700);
- $shape2->setOffsetY(540);
- $shape2->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );
- $shape2->getAlignment()->setVertical( PHPPowerPoint_Style_Alignment::VERTICAL_CENTER );
- $textRun2 = $shape2->createTextRun(‘Date: 2009-4-30‘);
- $textRun2->getFont()->setSize(14);
- $textRun2->getFont()->setColor( new PHPPowerPoint_Style_Color( ‘FF000000‘ ) );
- $objWriter = PHPPowerPoint_IOFactory::createWriter($ppp, ‘PowerPoint2007‘);
- $objWriter->save(ROOT . ‘myPhpPpt.pptx‘);
- echo ‘ppt create success!‘;
- ?>
这个东西的应用前景的话. 在WEB的某些场合还是很有用的. 需要的朋友可以多花点时间去研究了.
网上几乎很少有相关资料,找了好久,拿上来跟大家分享,同时感谢作者,。
php phppowerpoint
原文:http://www.cnblogs.com/liuwenbohhh/p/4354193.html