国产激情自拍_国产9色视频_丁香花在线电影小说观看 _久久久久国产精品嫩草影院

首頁 > 編程 > PHP > 正文

PHP讀取PPT文件的方法

2020-03-22 20:06:10
字體:
來源:轉載
供稿:網友
本文實例講述了PHP讀取PPT文件的方法。分享給大家供大家參考,具體如下:最近做一個和FLASH有關的東西,其中就要用到在網站上看PPT就像百度,豆丁網那樣可以直接在網站上讀,在網上搜了半天沒搜到,都是些什么安裝個軟件什么的,PHP網站放到空間上,誰能讓你在哪裝軟件呢?不是在瞎扯么?不過還好,最后在國外一個網站上搜到了一個解決思路,就是一個PHP操作PPT的類,當然這個網站還提供了操作OFFICES軟件的其他類,不過是2007版的OFFICES,現把網址貼出來奉獻給大家:http://phppowerpoint.codeplex.com/。也可點擊此處本站下載。這個類可以實現 PPT2007格式的讀寫/生成下面也貼出當時看到的一個例子:本例子使用phppowerpoint類,使用該類注意兩點,一個是了解參數含義,二注意字符集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('Introduction 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 $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_Slidefunction 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;我的問題仍然還在研究中,如果大家有更好的解決方法,請繼續貼,期待更多好的分享希望本文所述對大家PHP程序設計有所幫助。PHP教程

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
国产激情自拍_国产9色视频_丁香花在线电影小说观看 _久久久久国产精品嫩草影院
www在线视频观看| 中文字幕在线第一页| 2021av在线| 国产精品剧情一区二区在线观看 | av手机免费观看| www.九九热.com| 午夜伦全在线观看| 国产变态拳头交视频一区二区| 91网页在线观看| 中文日本在线观看| 九九热在线观看视频| 国产福利在线播放麻豆| 在线伊人免费视频| 久久久久久久久久久久久91| 国产人成在线观看| 日本在线观看| 国产福利免费在线观看| 久久精品视频观看| 性色视频在线| 在线影视一区| 国产三级视频在线播放线观看| 亚洲欧美小说国产图片| www.色婷婷| 久久亚洲国产成人亚| 中文资源在线官网| 国产中文字幕在线观看| 国产视频资源| 九九久久久2| 一本大道久久精品| 国产成人亚洲精品播放器下载| 欧美人成在线观看网站高清| 国产成人亚洲欧美电影| 久久国产情侣| 看成年女人免费午夜视频| 伊人精品影院| 在线观看免费高清完整| 精品欧美日韩一区二区| 国产叼嘿网站免费观看不用充会员| 麻豆av在线| 精品视频一区二区观看| 国产一级免费黄色片| 麻豆av在线| 免费在线你懂的| 免费在线观看a| 九九热视频在线观看| 波多野结衣中文字幕久久| 亚洲欧美精品日韩欧美| 中文在线视频观看| av免费在线一区二区三区| 精品伦理一区二区| 亚洲欧美精品中文第三| 日本动漫理论片在线观看网站| 任你操视频在线观看| www久久日com| 日本动漫理论片在线观看网站| 青青草视频免费在线观看| 免费女人毛片视频| 中文字幕专区| 在线视频99| 九九热免费视频| 国产精品入口麻豆免费看| 国产一二三在线观看| 精品国产二区三区| 久久国产精品黑丝| 国产wwww| 超碰在线影院| 国产高清在线a视频大全| av亚洲男人天堂| 五月伊人六月| 国产福利一区二区在线精品| gogo在线观看| 国产精品伦一区二区三区视频| 在线观看视频污| 18加网站在线| а√资源新版在线天堂| 国产小视频在线| 日本亚洲欧美| 18成年在线观看| 天堂在线中文| 日本免费视频www| 2020国产在线视频| 天天av天天爽| 久热中文字幕| av在线播放av| 国产日本视频| 国产网站麻豆精品视频| 另类综合图区| jlzzjlzz欧美大全| 91亚洲精选| 国产va在线观看| 国产网友自拍电影在线| 国内精品不卡| 国产在线超碰| 国产在线资源| 国内自拍视频在线看免费观看| 亚洲精品久久久成人| av福利在线播放| 精品视频vs精品视频| 国产高清视频在线| 99热在线免费播放| 国产卡二和卡三的视频| 国产69精品久久app免费版 | 在线三级av| 97视频在线观看网站| 国产精品四虎| 97在线免费| 亚洲色婷婷综合开心网| а√最新版地址在线天堂| 日本高清不卡中文字幕| 久久精品视频观看| 国产乱妇乱子| 国产日韩欧美第一页| 国产精品视频一区麻豆| 在线一区观看| 久久精品视频观看| 国产一级影片| av首页在线| 日韩av成人| 精品欧美色视频网站在线观看| 亚洲妇熟xxxx妇色黄| 好男人社区在线视频| 国产高清免费av在线| av网址在线看| 午夜免费福利在线观看| 精品美女在线观看视频在线观看| 中文资源在线网| а√天堂8资源在线官网 | 欧美黑人乱大交| 中文字幕视频在线观看| 国产高清av| 久热中文字幕精品视频在线| 中文字幕一区免费| 亚洲成人电视网| 中文字幕国产在线| 午夜羞羞小视频在线观看| 国产麻豆视频网站| av在线不卡网站| 国产福利免费观看| 国产真实伦在线观看| 亚洲精品自拍区在线观看| 成人欧美日韩| 亚洲精品影院在线| 国产高清一级片| 国产美女福利在线| 蜜桃av网站| www免费在线观看| 99福利在线| 国产福利电影在线| 国产一二三在线观看| 久久精品亚洲7777影院| av在线日韩国产精品| 精品176二区| 7777在线| 91在线视频免费看| 9色在线视频网站| 国产高清免费av在线| 午夜av电影| 久精品在线观看| 久青青在线观看视频国产| а√天堂www在线а√天堂视频| 精品一区二区91| 精品国产免费第一区二区| 国产高清在线看| 精品美女视频在线观看免费软件| 国产精品视频福利一区二区| 国产探花视频在线观看| 国产精品18久久久久网站| 136福利第一导航国产在线| 精品麻豆一区二区三区| 在线免费观看黄色av| 伊人伊人av电影| 亚洲xxxxxx| 黄色片av在线| 国产特级淫片免费看| 97视频免费| 爱福利在线视频| 国产一区二区影视| 2021天堂中文幕一二区在线观| av人人综合网| 久久久久久77777| 国产小视频在线高清播放| 国产福利免费观看| 日本成人a视频| 国产一二三四| 天天草天天爽| 国产一区二区三区不卡免费观看 | 91麻豆精品国产91久久| 在线免费黄色毛片| 久久av少妇| 在线视频1区2区| 国产亚洲精品一区二区在线观看| 国产aa视频| 欧美精品se| 国产娇喘精品一区二区三区图片| 四虎久久影院| 国产精品第八页| 欧美黑人乱大交| 午夜在线视频播放| 国产精品久久久久一区二区国产 | 色吊丝av中文字幕|