note 88943 added to class.com

From: Date: Sat, 14 Feb 2009 13:42:08 +0000
Subject: note 88943 added to class.com
Groups: php.notes 
Request: Send a blank email to php-notes+get-150673@lists.php.net to get a copy of this message
This is the code for entering Values in MS word through Php Program. First : You need to make word file with including Boolmark (Ms word 2003 , Insert -> Bookmark ->Bookmark Name -> add). Example Name : add here bookmark This is something like input as a text box. Here I given 5 fields. Name , TODAYDATE , Company ,project , Features Here I opened a word file, and put data into Bookmark fields using PHP. Just note : it works in c:/ only. (not sure why), C:/program files may take longer time. (waiting for ...) <?php com_load_typelib('Word.Application'); $word = new COM("word.application") or die("Unable to instantiate Word"); // use like this. Place your's word file in C drive $word->Documents->Open('C:/reminder_new.doc'); echo $current_date = date("m/d/Y"); $tim= date("Y-m-d"); $info_array=array( "Name" => "pavan", "TODAYDATE" => "$tim" , "Company" => "sparsh" , "project" => "Myrepc", "Features" => "Auto fill form editor") ; foreach($info_array as $bookmarkname => $re) { $objBookmark = $word->ActiveDocument->Bookmarks($bookmarkname); $range = $objBookmark->Range; echo $range->Text = $re ; } $new_file = "c:/reminder_filled.doc"; $word->Documents[1]->SaveAs($new_file); $word->ActiveDocument->Close(false); $word->Quit(); $word = null; ?> ---- Server IP: 59.162.86.33 Probable Submitter: 202.71.158.146 ---- Manual Page -- http://www.php.net/manual/en/class.com.php Edit -- https://master.php.net/note/edit/88943 Del: integrated -- https://master.php.net/note/delete/88943/integrated Del: useless -- https://master.php.net/note/delete/88943/useless Del: bad code -- https://master.php.net/note/delete/88943/bad+code Del: spam -- https://master.php.net/note/delete/88943/spam Del: non-english -- https://master.php.net/note/delete/88943/non-english Del: in docs -- https://master.php.net/note/delete/88943/in+docs Del: other reasons-- https://master.php.net/note/delete/88943 Reject -- https://master.php.net/note/reject/88943 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#150673) next »