<html> <head> <title>ThaiCreate.Com PHP Word.Application Tutorial</title> </head> <body> <?php $wdAlignParagraphCenter = "1"; $Wrd = new COM("Word.Application"); $DocName = "MyDoc/MyWord.doc"; //$strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); // C:/AppServ/www/myphp $Wrd->Application->Visible = False; $WrdDoc = $Wrd->Documents->Open(realpath("thaicreate.dot")); $MyRange1 = $WrdDoc->Range(); $MyRange1->ParagraphFormat->Alignment = $wdAlignParagraphCenter; $MyRange1->Font->Name = "Verdana"; $MyRange1->Font->Size = "30"; $MyRange1->Font->Bold = True; $MyRange1->InsertBefore(chr(13).chr(13)."www.ThaiCreate.Com".chr(13)."Version 2009".chr(13)); $MyRange1 = $WrdDoc->Paragraphs->Add->Range; $MyRange1->InlineShapes->AddPicture(realpath("thaicreate-2009.gif")); $MyRange1 = $WrdDoc->Paragraphs->Add->Range; $MyRange1->ParagraphFormat->Alignment = $wdAlignParagraphCenter; $MyRange1->Font->Name = "Verdana"; $MyRange1->Font->Size = "13"; $MyRange1->Font->Bold = True; $MyRange1->InsertBefore(chr(13).chr(13).chr(13).chr(13)."All Rights Reserved."); //$WrdDoc->SaveAs($strPath."/".$DocName); $WrdDoc->SaveAs(realpath($DocName)); $Wrd->Application->Quit; $Wrd = null; ?> Word Created <a href="<?php echo $DocName?>">Click here</a> to Download. </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท