Jump to content

craete word doc using php script


ksamir2004

Recommended Posts

Hi All,

 

can any one help me to creating word doc using php script.

Requirement

 

i have created Text editor. but what ever content we i can create in text editor it should save in word document.

 

i am sending php script to you.. this is static but i want to save dynamic contents.

 

<?php

// starting word

$word = new COM("word.application") or die("Unable to instantiate Word");

echo "Loaded Word, version {$word->Version}\n";

 

//bring it to front

$word->Visible = 1;

 

//open an empty document

$word->Documents->Add();

 

//do some weird stuff

$word->Selection->TypeText("This is a test...");

$word->Documents[1]->SaveAs("text1.doc");

 

//closing word

$word->Quit();

 

//free the object

$word = null;

?>

 

 

please send code or Advice me on this is highly appreciated.

 

Regards,

Sam

Link to comment
https://forums.phpfreaks.com/topic/104508-craete-word-doc-using-php-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.