[Question] I am speechless when I read the wordCOM component exception information from PHP.

Source: Internet
Author: User
[Question] I am speechless when PHP reads the error message of the wordCOM component !!!! PHPcode & lt ;? Php creates an index pointing to the new COM component $ wordnewCOM (& quot; word. application & quot;) ordie (& quot; CantstartWord! & Quot;); open a document $ w [question] PHP to read the error message of the word COM component. I am speechless !!!!
PHP code
  
  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



------ Solution --------------------
The first instance is not closed.

------ Solution --------------------
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.