?
Solved

Problem reading word file using COM in php

Posted on 2003-02-19
3
Medium Priority
?
289 Views
Last Modified: 2013-12-13
Can no one help with this? I have search all over the internet in messageboards and articles. Everyone seems to just give up on this error. Surely there is someone who knows how to fix it.

PHP Warning: Invoke() failed: Exception occurred. Source: Microsoft Word Description: Could not open macro storage. in c:\inetpub\wwwroot\convert.php on line 18

Here is the code I am using

<?php

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

// if you want see the World interface the value must be '1' else '0'
$word->Visible = 1;

//doc file location
$word->Documents->Open("c:\\wwwroot\\trial.doc");

//html file location  '8' mean HTML format
$word->Documents[1]->SaveAs("c:\\wwwroot\\trial.html",8);

//closing word
$word->Quit();

?>

I have checked that the IUSER in security settings is set to interactive.
I have checked for case sensitivity.

All help or even ideas would be greatfully appreciated.
0
Comment
Question by:flashharry82
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
laurly earned 300 total points
ID: 7980792
1. make sure word isn't open
2. check the win2k process list because for every time the script crashes you have a winword.exe sitting there.
reason. it opens win word at the beginning of the script if it crashes before it gets to the quit your up a creak.
note: it was actually kind of funny. by the time I realized it I had 30 * winword.exe running.


check this out:
http://www.phpbuilder.com/columns/alain20001003.php3


when i did this i was only createing a new file test this:

<?php
$word=new COM("Word.Application") or die("Cannot start word for you");
print "Loaded word version ($word->Version)\n";

$word->visible =1 ;
$word->Documents->Add();
$word->Selection->Typetext("testing ....");
$word->Documents[1]->SaveAs("c:\web\just_a_test2.doc");
$word->Quit();
print "Done ...........\n";
?>


hope it helps

laurly
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question