Re: PHP and COM - Syntax question

From: Date: Fri, 18 Jan 2002 21:22:10 +0000
Subject: Re: PHP and COM - Syntax question
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-81154@lists.php.net to get a copy of this message
Hopefully this is my last reply on this thread. I discovered after opening Word normally after a few dozen tests, that it tried to "recover" all those "lost" documents. The following demo script has that fixed. <?php 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; } if ($text) { $checkedtext= spellcheck($text); print($checkedtext); } else { ?> <form action="spellcheck.php" method="post"> Enter Text<textarea name="text"></textarea> <input type="submit"> </form> <?php } ?>

« previous php.general (#81154) next »