[Question] I am speechless when PHP reads the error message from the wordCOM component.
Documents-> OPen ("F:/wamp/www/oa/111.doc"); // read the document content $ test = $ word-> ActiveDocument-> content-> Text; echo $ test; echo"
"; // Replace $ test = str_replace (" <{variable}> "," This is a variable ", $ test); echo $ test; $ word-> Documents-> Add (); // Add the text in the new document $ word-> Selection-> TypeText ("$ test "); // save the document in the directory $ word-> Documents [1]-> SaveAs ("F: \ wamp \ www \ oa \ 111.doc "); // close the connection to the COM component $ word-> Quit ();?>
Error reports in IE browser
Fatal error: Uncaught exception 'com _ exception' with message 'failed' to create com object 'word. application': CoInitialize has not been called. 'In F: \ wamp \ www \ oa \ newfile. php: 3 Stack trace: #0 F: \ wamp \ www \ oa \ newfile. php (3): com-> com ('Word. applicatio... ') #1 {main} thrown in F: \ wamp \ www \ oa \ newfile. php on line 3
Travel error reports
Fatal error: Uncaught exception 'com _ exception' with message 'failed' to create com object 'word. application': CoInitialize has not been called. 'In F: \ wamp \ www \ oa \ newfile. php: 3 Stack trace: #0 F: \ wamp \ www \ oa \ newfile. php (3): com-> com ('Word. applicatio... ') #1 {main} thrown in F: \ wamp \ www \ oa \ newfile. php on line 3
I beg for an explanation
Reply to discussion (solution)
The first time you start the test in the morning, it is okay. if you change the name of a word, an error will be reported again after the test.
The first instance is not closed.
The first time you start the test in the morning, it is okay. if you change the name of a word, an error will be reported again after the test.
Sorry, I didn't understand it.
The same code.
The first instance is not closed.
Sorry, I didn't understand it.
The same code.
The third line is wrong. Or a fatal error. "F:/wamp/www/oa/111.doc and F: \ wamp \ www \ oa \ 111.doc do you have a problem with this path? Check carefully.
Why is the result of my editing 14 rows incorrect?
Fatal error: Uncaught exception 'com _ exception' with message'Source:Microsoft Word
Description:??? Why? Bytes