当前位置:首页 » 编程语言 » phpppt

phpppt

发布时间: 2022-01-17 07:22:13

A. 怎么用php读取ppt文档的内容,并且在浏览器

本文实例讲述了PHP读取PPT文件的方法。分享给大家供大家参考,具体如下:
最近做一个和FLASH有关的东西,其中就要用到在网站上看PPT就像网络,豆丁网那样可以直接在网站上读,在网上搜了半天没搜到,都是些什么安装个软件什么的,PHP网站放到空间上,谁能让你在哪装软件呢?不是在瞎扯么?不过还好,最后在国外一个网站上搜到了一个解决思路,就是一个PHP操作PPT的类,当然这个网站还提供了操作OFFICES软件的其他类,不过是2007版的OFFICES
下面也贴出当时看到的一个例子:
本例子使用phppowerpoint类,使用该类注意两点,一个是了解参数含义,二注意字符集
?


<?phpheader("content-type:text/html;charset=utf-8");//字体设置防止乱码error_reporting(E_ALL);/** Include path **/set_include_path(get_include_path() . PATH_SEPARATOR . '../Classes/');/** PHPPowerPoint */include 'PHPPowerPoint.php';/** PHPPowerPoint_IOFactory */include 'PHPPowerPoint/IOFactory.php';// Create new PHPPowerPoint object//echo date('H:i:s') . " Create new PHPPowerPoint object\n";$objPHPPowerPoint = new PHPPowerPoint();$objPHPPowerPoint->getProperties()->setCreator("Maarten Balliauw");$objPHPPowerPoint->getProperties()->setLastModifiedBy("Maarten Balliauw");$objPHPPowerPoint->getProperties()->setTitle("Office 2007 PPTX Test Document");$objPHPPowerPoint->getProperties()->setSubject("Office 2007 PPTX Test Document");$objPHPPowerPoint->getProperties()->setDescription("Test document for Office 2007 PPTX, generated using PHP classes.");$objPHPPowerPoint->getProperties()->setKeywords("office 2007 openxml php");$objPHPPowerPoint->getProperties()->setCategory("Test result file");// Remove first slide//echo date('H:i:s') . " Remove first slide\n";$objPHPPowerPoint->removeSlideByIndex(0);// Create templated slide//echo date('H:i:s') . " Create templated slide\n";/*$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(200);$shape->setWidth(600);$shape->setOffsetX(10);$shape->setOffsetY(400);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('Introction to');$textRun->getFont()->setBold(true);$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun('PHPPowerPoint');$textRun->getFont()->setBold(true);$textRun->getFont()->setSize(60);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create templated slideecho date('H:i:s') . " Create templated slide\n";$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(100);$shape->setWidth(930);$shape->setOffsetX(10);$shape->setOffsetY(10);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('What is PHPPowerPoint?');$textRun->getFont()->setBold(true);$textRun->getFont()->setSize(48);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(600);$shape->setWidth(930);$shape->setOffsetX(10);$shape->setOffsetY(100);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('- A class library');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun('- Written in PHP');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun('- Representing a presentation');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun('- Supports writing to different file formats');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create templated slideecho date('H:i:s') . " Create templated slide\n";$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(100);$shape->setWidth(930);$shape->setOffsetX(10);$shape->setOffsetY(10);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('What\'s the point?');$textRun->getFont()->setBold(true);$textRun->getFont()->setSize(48);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(600);$shape->setWidth(930);$shape->setOffsetX(10);$shape->setOffsetY(100);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('- Generate slide decks');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' - Represent business data');$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' - Show a family slide show');$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' - ...');$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun('- Export these to different formats');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' - PowerPoint 2007');$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' - Serialized');$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' - ... (more to come) ...');$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create templated slideecho date('H:i:s') . " Create templated slide\n";$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(100);$shape->setWidth(930);$shape->setOffsetX(10);$shape->setOffsetY(10);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('Need more info?');$textRun->getFont()->setBold(true);$textRun->getFont()->setSize(48);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(600);$shape->setWidth(930);$shape->setOffsetX(10);$shape->setOffsetY(100);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('Check the project site on CodePlex:');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' );$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create templated slideecho date('H:i:s') . " Create templated slide\n";*///test//从数据库调取数据进行for循环$row=array('titlepic'=>array('./images/love.gif','./images/love1.gif','./images/love2.gif','./images/love3.gif'),'xsprice'=>array("55","33","22","333"),'cjid'=>array('100','222','333','3333'),'lpid'=>array('111','222','333','444'),'price'=>array('111','433','243','3245'));for($i=0;$i<4;$i++){$currentSlide = createTemplatedSlide1($objPHPPowerPoint,$row["titlepic"][$i]); // local function// Create a shape (text)//echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(100);$shape->setWidth(930);//调整字体的高度宽度$shape->setOffsetX(20);$shape->setOffsetY(400);//$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$row["price"]=iconv("utf-8","gb2312",$row["price"][$i]);$textRun = $shape->createTextRun('礼品网价格:'.$row["xsprice"][$i]);$textRun->getFont()->setBold(true);$textRun->getFont()->setSize(48);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( '#000000' ) );$shape = $currentSlide->createRichTextShape();$shape->setHeight(600);$shape->setWidth(930);$shape->setOffsetX(20);$shape->setOffsetY(500);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );//添加多行内容从这开始$textRun = $shape->createTextRun('公司编号: '.$row["cjid"][$i]);$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( '#000000' ) );$shape->createBreak();$textRun = $shape->createTextRun('礼品网编号: '.$row["lpid"][$i]);$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( '#000000' ) );//test// Save PowerPoint 2007 file}//echo date('H:i:s') . " Write to PowerPoint2007 format\n";$objWriter = PHPPowerPoint_IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007');$objWriter->save(str_replace('.php', '.pptx',__FILE__));header("Content-type:application/vnd.ms-powerpoint;");header("location:02presentation.pptx");// Echo memory peak usage//echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";// Echo done//echo date('H:i:s') . " Done writing file.\r\n";/*** Creates a templated slide** @param PHPPowerPoint $objPHPPowerPoint* @return PHPPowerPoint_Slide*/function createTemplatedSlide1(PHPPowerPoint $objPHPPowerPoint,$cs1){// Create slide$slide = $objPHPPowerPoint->createSlide();// Add background image$shape = $slide->createDrawingShape();$shape->setName('Background');$shape->setDescription('Background');$shape->setPath('./images/realdolmen_bg.jpg');$shape->setWidth(950);$shape->setHeight(720);$shape->setOffsetX(0);$shape->setOffsetY(0);// Add logo$shape = $slide->createDrawingShape();$shape->setName('PHPPowerPoint logo');$shape->setDescription('PHPPowerPoint logo');$shape->setPath($cs1);$shape->setHeight(120);$shape->setOffsetX(10);$shape->setOffsetY(10);// Return slidereturn $slide;}

B. php 修改 PPT

国外的 php操作PPT 类
http://phppowerpoint.codeplex.com/

C. 能用php生成powerpoint文件吗

搜一下PHPPowerpoint这个库

D. php如何实现从数据库读取ppt文件

<?php
header("content-type:text/html;charset=utf-8");//字体设置防止乱码
error_reporting(E_ALL);
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../Classes/');
/** PHPPowerPoint */
include 'PHPPowerPoint.php';
/** PHPPowerPoint_IOFactory */
include 'PHPPowerPoint/IOFactory.php';
// Create new PHPPowerPoint object
//echo date('H:i:s') . " Create new PHPPowerPoint object\n";
$objPHPPowerPoint = new PHPPowerPoint();
$objPHPPowerPoint->getProperties()如果你对php有兴趣的话,可以向我一样在后盾人视频平台多看看自己学习学习,时间长了自己就慢慢明白了,希望能帮到你,给个采纳吧谢谢(≧㉨≦)

E. PHP如何实现在页面中点击超链接播放PPT和视频

首先你要面对现实不要逃避,你越怕,心里就越难受.谁也不知道自己的未来究竟是怎么样的,如果你真的爱他,不想失去他,那就和自己的命运赌上一把,就算输了也不要后悔自己的选择,如果赢了那将换来的是你一生的幸福.你选择的男朋友,就算你的家人会不同意,也没有关系,时间会证明好与坏,在说今后要在一起生活的毕竟是你和他.不要迷惘了,如果连你自己都不知道该怎么办的话,谁也帮不了你.好好的冷静一下,认真的思考,到底这个男人值不值得你为了他这么做,如果值得的话那就堵一把!

F. phppowerpoint类怎么设置生成幻灯片大小,默认导出的都是标准4:3的,需要导出为16:9宽屏的

设计、页面设置、幻灯片大小

G. PHP如何操作ppt啊 - 技术问答

VB操作部分搞定了Private Sub Command1_Click()\'定义Powerpoint相关变量Dim pptApp As PowerPoint.ApplicationDim pptPre As PowerPoint.PresentationSet pptApp = CreateObject(\"Powerpoint.Application\")pptApp.Visible = TrueSet pptPre = pptApp.Presentations.Add(msoTrue)\'打开并生成新的ppt文件Set pptPre = pptApp.Presentations.Open(\"c:\\test.ppt\", , , msoFalse)Dim ppSlide1 As PowerPoint.SlideSet ppSlide1 = pptPre.Slides(1)\' Add some text.\'这一段可以通过PPT中的录制宏脚本来得到具体的代码Label1.Caption = ppSlide1.Shapes(1).TextFrame.TextRange.TextppSlide1.Shapes(1).TextFrame.TextRange.Text = \"My first slide\"ppSlide1.Shapes(2).TextFrame.TextRange.Text = \"Automating Powerpoint is easy\" & vbCr & \"Using Visual Basic is fun!111\"ppSlide1.Shapes(1).TextFrame.TextRange.Characters(Start:=1, Length:=5).Font.Size = 20? ? \'另存为定义的位置与文件名pptPre.SaveAs \"c:\\test1.ppt\"\'保存pptPre.Save? ?? ?? ?? ?? ?? ???\'关闭pptPre.ClosepptApp.QuitSet pptPre = NothingSet pptApp = NothingEnd Sub

H. PHP PPT,PDF 转化图片

方法1:打开pdf文件,选择菜单命令“文件” → “另存为” ,弹出另存为对话框,选择保存类型为“jpg”,保存即可;
方法2:打开pdf文档,选择命令 “另存为其它” → “图像” → “JPEG或JPEG2000”;
方法3:打开pdf文档,选择“编辑”菜单下的“拍快照”(注:选中后,在拍快照前面会有个√显示),同时鼠标变成十字光标,此时拖动鼠标框选你要变换的区域,松开鼠标,弹出确认对话框,点击确认,此时框选的部分已经保存到剪贴板,然后打开系统自带的画图工具,粘贴后保存为jpg文档。方法不适合图片过多的情况,不建议使用!
方法4:试试在线PDF转图片共有以下几个步骤:
• 点击浏览按钮选择需要转换的PDF文件。
• 输入需要转换的页码,以逗号分割开,如果转换所有的页面可以跳过这一步。
• 点击按钮上传文件,然后等着就可以了。
• 点击下载链接把做好的文件下载到本地就可以了。仅适合低于2MB的文件转换!
方法5:借助pdf转换器。选中pdf转图片功能,然后右下角选择“上传文件或文件夹”,即可一键开始转换,此外还支持转word、excel、ppt等格式。

I. PHP如何读取PPT

<?php header("content-type:text/html;charset=utf-8");//字体设置防止乱码 error_reporting(E_ALL); /** Include path **/ set_include_path(get_include_path() . PATH_SEPARATOR . '../Classes/'); /** PHPPowerPoint */ include 'PHPPowerPoint.php'; /** PHPPowerPoint_IOFactory */ include 'PHPPowerPoint/IOFactory.php'; // Create new PHPPowerPoint object //echo date('H:i:s') . " Create new PHPPowerPoint object\n"; $objPHPPowerPoint = new PHPPowerPoint(); $objPHPPowerPoint->getProperties()->setCreator("Maarten Balliauw"); $objPHPPowerPoint->getProperties()->setLastModifiedBy("Maarten Balliauw"); $objPHPPowerPoint->getProperties()->setTitle("Office 2007 PPTX Test Document"); $objPHPPowerPoint->getProperties()->setSubject("Office 2007 PPTX Test Document"); $objPHPPowerPoint->getProperties()->setDescription("Test document for Office 2007 PPTX, generated using PHP classes."); $objPHPPowerPoint->getProperties()->setKeywords("office 2007 openxml php"); $objPHPPowerPoint->getProperties()->setCategory("Test result file"); // Remove first slide //echo date('H:i:s') . " Remove first slide\n"; $objPHPPowerPoint->removeSlideByIndex(0); // Create templated slide //echo date('H:i:s') . " Create templated slide\n"; /*$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function // Create a shape (text) echo date('H:i:s') . " Create a shape (rich text)\n"; $shape = $currentSlide->createRichTextShape(); $shape->setHeight(200); $shape->setWidth(600); $shape->setOffsetX(10); $shape->setOffsetY(400); $shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT ); $textRun = $shape->createTextRun('Introction to'); $textRun->getFont()->setBold(true); $textRun->getFont()->setSize(28); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); $shape->createBreak(); $textRun = $shape->createTextRun('PHPPowerPoint'); $textRun->getFont()->setBold(true); $textRun->getFont()->setSize(60); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); // Create templated slide echo date('H:i:s') . " Create templated slide\n"; $currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function // Create a shape (text) echo date('H:i:s') . " Create a shape (rich text)\n"; $shape = $currentSlide->createRichTextShape(); $shape->setHeight(100); $shape->setWidth(930); $shape->setOffsetX(10); $shape->setOffsetY(10); $shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT ); $textRun = $shape->createTextRun('What is PHPPowerPoint?'); $textRun->getFont()->setBold(true); $textRun->getFont()->setSize(48); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); // Create a shape (text) echo date('H:i:s') . " Create a shape (rich text)\n"; $shape = $currentSlide->createRichTextShape(); $shape->setHeight(600); $shape->setWidth(930); $shape->setOffsetX(10); $shape->setOffsetY(100); $shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT ); $textRun = $shape->createTextRun('- Generate slide decks'); $textRun->getFont()->setSize(36); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); $shape->createBreak(); $textRun = $shape->createTextRun(' - Represent business data'); $textRun->getFont()->setSize(28); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); $shape->createBreak(); $textRun = $shape->createTextRun(' - Show a family slide show'); $textRun->getFont()->setSize(28); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); $shape->createBreak(); $textRun = $shape->createTextRun(' - ...'); $textRun->getFont()->setSize(28); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); $shape->createBreak(); $textRun = $shape->createTextRun('- Export these to different formats'); $textRun->getFont()->setSize(36); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); $shape->createBreak(); $textRun = $shape->createTextRun(' - PowerPoint 2007'); $textRun->getFont()->setSize(28); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); $shape->createBreak(); $textRun = $shape->createTextRun(' - Serialized'); $textRun->getFont()->setSize(28); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); $shape->createBreak(); $textRun = $shape->createTextRun(' - ... (more to come) ...'); $textRun->getFont()->setSize(28); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); // Create templated slide echo date('H:i:s') . " Create templated slide\n"; $currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function // Create a shape (text) echo date('H:i:s') . " Create a shape (rich text)\n"; $shape = $currentSlide->createRichTextShape(); $shape->setHeight(100); $shape->setWidth(930); $shape->setOffsetX(10); $shape->setOffsetY(10); $shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT ); $textRun = $shape->createTextRun('Need more info?'); $textRun->getFont()->setBold(true); $textRun->getFont()->setSize(48); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); // Create a shape (text) echo date('H:i:s') . " Create a shape (rich text)\n"; $shape = $currentSlide->createRichTextShape(); $shape->setHeight(600); $shape->setWidth(930); $shape->setOffsetX(10); $shape->setOffsetY(100); $shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT ); $textRun = $shape->createTextRun('Check the project site on CodePlex:'); $textRun->getFont()->setSize(36); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); $shape->createBreak(); $textRun = $shape->createTextRun(' ); $textRun->getFont()->setSize(36); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) ); // Create templated slide echo date('H:i:s') . " Create templated slide\n";*/ //test //从数据库调取数据进行for循环 $row=array('titlepic'=>array('./images/love.gif','./images/love1.gif','./images/love2.gif','./images/love3.gif'),'xsprice'=>array("55","33","22","333"),'cjid'=>array('100','222','333','3333'),'lpid'=>array('111','222','333','444'),'price'=>array('111','433','243','3245')); for($i=0;$i<4;$i++) { $currentSlide = createTemplatedSlide1($objPHPPowerPoint,$row["titlepic"][$i]); // local function // Create a shape (text) //echo date('H:i:s') . " Create a shape (rich text)\n"; $shape = $currentSlide->createRichTextShape(); $shape->setHeight(100); $shape->setWidth(930); //调整字体的高度宽度 $shape->setOffsetX(20); $shape->setOffsetY(400); //$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT ); $row["price"]=iconv("utf-8","gb2312",$row["price"][$i]); $textRun = $shape->createTextRun('礼品网价格:'.$row["xsprice"][$i]); $textRun->getFont()->setBold(true); $textRun->getFont()->setSize(48); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( '#000000' ) ); $shape = $currentSlide->createRichTextShape(); $shape->setHeight(600); $shape->setWidth(930); $shape->setOffsetX(20); $shape->setOffsetY(500); $shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT ); //添加多行内容从这开始 $textRun = $shape->createTextRun('公司编号: '.$row["cjid"][$i]); $textRun->getFont()->setSize(36); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( '#000000' ) ); $shape->createBreak(); $textRun = $shape->createTextRun('礼品网编号: '.$row["lpid"][$i]); $textRun->getFont()->setSize(36); $textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( '#000000' ) ); //test // Save PowerPoint 2007 file } //echo date('H:i:s') . " Write to PowerPoint2007 format\n"; $objWriter = PHPPowerPoint_IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007'); $objWriter->save(str_replace('.php', '.pptx',__FILE__)); header("Content-type:application/vnd.ms-powerpoint;"); header("location:02presentation.pptx"); // Echo memory peak usage //echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n"; // Echo done //echo date('H:i:s') . " Done writing file.\r\n"; /** * Creates a templated slide * * @param PHPPowerPoint $objPHPPowerPoint * @return PHPPowerPoint_Slide */ function createTemplatedSlide1(PHPPowerPoint $objPHPPowerPoint,$cs1) { // Create slide $slide = $objPHPPowerPoint->createSlide(); // Add background image $shape = $slide->createDrawingShape(); $shape->setName('Background'); $shape->setDescription('Background'); $shape->setPath('./images/realdolmen_bg.jpg'); $shape->setWidth(950); $shape->setHeight(720); $shape->setOffsetX(0); $shape->setOffsetY(0); // Add logo $shape = $slide->createDrawingShape(); $shape->setName('PHPPowerPoint logo'); $shape->setDescription('PHPPowerPoint logo'); $shape->setPath($cs1); $shape->setHeight(120); $shape->setOffsetX(10); $shape->setOffsetY(10); // Return slide return $slide; }

J. 用php实现ppt文件下载

上传部分应该如何判断type和size?

foreach ($fname as $index => $name)
{
if($fsize[$index]>0 && $ftype[$index]=='txt') //判断文件大小和文件扩展名
{
if (move_uploaded_file($_FILES['upload']['tmp_name'][$index],'c:/xampp/htdocs/course/upload_course/' . $name))
{
echo "文件:" . $name . ",上传成功<br>";
exit;
} else
echo "文件:" . $name . ",上传失败<br>";
}
}

如果没有特殊的操作,个人认为,直接改写

echo "<td><a href=course_download1.php?file=$pathinfo"."/".$file.">下载该文件</a> ";

热点内容
怎么把小程序源代码放在服务器 发布:2024-12-26 13:06:18 浏览:244
java的byte转string 发布:2024-12-26 13:04:43 浏览:926
源码带支付接口 发布:2024-12-26 12:36:29 浏览:637
我的世界服务器公告栏内容怎么改 发布:2024-12-26 12:35:53 浏览:158
python的类方法 发布:2024-12-26 12:31:12 浏览:360
编译器c语言输入不了中文 发布:2024-12-26 12:21:05 浏览:43
配电脑用什么配置 发布:2024-12-26 12:21:05 浏览:286
不知密码如何删除短信 发布:2024-12-26 12:05:46 浏览:892
普通民众怎么存储汽油 发布:2024-12-26 12:05:36 浏览:629
安卓手机已安装的软件如何备份 发布:2024-12-26 12:04:59 浏览:422