Re: Create Word Document from PHP??

From: Date: Wed, 06 Mar 2002 16:14:00 +0000
Subject: Re: Create Word Document from PHP??
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-87486@lists.php.net to get a copy of this message
Don't know what code you're using to do this, but here's a spellcheck function that creates a new Word doc. See if this works for you. function spellcheck($string){ $word = new COM("word.application") or die("The spellcheck function requires MS Word."); $word->Visible = 0; $word->Documents->Add(); $word->Selection->TypeText($string); $word->ActiveDocument->CheckSpelling(); $word->Selection->WholeStory(); $corrected = $word->Selection->Text; $word->ActiveDocument->Close(false); $word->Quit(false); $word->Release(); $word = null; return $corrected; } "Jeremy Spielmann" <php@mail.candleplanet.com> wrote in message news:200203051721.AA1603862830@mail.candleplanet.com... > I've been trying to create a MS Word document from PHP, but I've been running into some issues. I was wondering if there was anything in the config file (php.ini) that needs to be configured before I can do this. > > I'm using the example from the manual, but i'm receiving several errors. > > ############################ > Loaded Word, version 9.0 > Warning: Invoke() failed: Exception occurred. Source: Microsoft Word Description: Could not open macro storage. in C:\Inetpub\wwwroot\php\word.php on line 11 > > Warning: Invoke() failed: Exception occurred. Source: Microsoft Word Description: The requested member of the collection does not exist. in C:\Inetpub\wwwroot\php\word.php on line 15 > PHP Warning: Invoke() failed: Exception occurred. Source: Microsoft Word Description: Could not open macro storage. in C:\Inetpub\wwwroot\php\word.php on line 11 PHP Warning: Invoke() failed: Exception occurred. Source: Microsoft Word Description: The requested member of the collection does not exist. in C:\Inetpub\wwwroot\php\word.php on line 15 > ################################################# > > Any help would be appreciated... > > Thanks, > > Jeremy

« previous php.general (#87486) next »