Hi, I tried the code below to make a word document.
$word = new COM("word.application") or die ("couldnt create an instance of word");
echo "loaded , word version{$word->version}";
//bring word to the front
$word->visible = 1;
//open a word document
$word->Documents->Add();
//add some text to the document
$word->Selection->TypeText("this is some sample text in the document");
//save the document as sampleword.doc
$word->Documents[1]->SaveAs("sampleword.doc");
//close word
$word->Quit();
//free object resources
$word->Release ();
$word = null;
- $word = new COM("word.application") or die ("couldnt create an instance of word");
- echo "loaded , word version{$word->version}";
- //bring word to the front
- $word->visible = 1;
- //open a word document
- $word->Documents->Add();
- //add some text to the document
- $word->Selection->TypeText("this is some sample text in the document");
- //save the document as sampleword.doc
- $word->Documents[1]->SaveAs("sampleword.doc");
- //close word
- $word->Quit();
- //free object resources
- $word->Release ();
- $word = null;
What I get is an error :
-----------------------------------------------------------------
Fatal error: Uncaught exception 'com_exception' with message 'Error [0x80020003] Kan lid niet vinden. ' in D:\xampp\htdocs\basiccv\Maakpdf.php:42 Stack trace: #0 D:\xampp\htdocs\basiccv\Maakpdf.php(42): com->Release() #1 {main} thrown in D:\xampp\htdocs\basiccv\Maakpdf.php on line 42
-----------------------------------------------------------------
I Checked the documentation and I saw that the Release function is for PHP 5.X
I Use PHP Version 5.2.3
So the version is right.
Is RELEASE the line were you have to put the directory in?
Can someone help me with an understanable sollution?
Thanks!