當前位置:首頁 » 編程語言 » 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-11-15 00:47:25 瀏覽:825
編程的悟性 發布:2024-11-15 00:47:24 瀏覽:733
主流可編譯語言 發布:2024-11-15 00:42:23 瀏覽:729
excel緩存清除 發布:2024-11-15 00:39:53 瀏覽:486
機械鍵盤可編程 發布:2024-11-15 00:39:09 瀏覽:912
php判斷字元開頭 發布:2024-11-15 00:35:33 瀏覽:507
網易蘋果游戲怎麼轉移到安卓 發布:2024-11-15 00:07:52 瀏覽:270
win7php環境搭建 發布:2024-11-15 00:06:55 瀏覽:17
erpjava 發布:2024-11-14 23:52:23 瀏覽:253
電腦版地平線四怎麼連上伺服器 發布:2024-11-14 23:46:42 瀏覽:472