Word gets the reader's questions early in the morning. So it's conveniently included here.
The example is to use Word to draw a 5x10 form through COM and to cram some data one by one into each area.
? PHP $word = new COM("Word.Application") or Die ("Unable to start Word program!") ");
$word->Visible = 1 ; $doc = $word->Documents->Add ();
$doc->Sections->Add($word ->Selection->Range,0); Add a section $Section = $doc->Sections(1); //Get the first bar object $Range = $Section->Range; // produce Range objects = $doc -> tables -> add $Range 5 ,  10 Forms that produce 5x10
Plug data into a table for ($i=1; $i <= Ten ; $i ++) { For ($j=1; $j <= 5 ; $j ++) { $Cell = $Table->Cell($j, $i /c10>); $CellRange = $Cell->Range $CellRange -> insertbefore CHR + $j CHR 0x40 + )); } }
$word->Documents[1]->SaveAs( "C:\\word.doc" ); $word->Quit (); $word-> Release(); $word = null ; ?>
|