[PHP-WIN] More COM Issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have created a snazzy little PHP widget that creats an actual hard HTML
page from a bunch of included pages and saves it as a temp.html file on
the server.  The app then invokes MS Word's COM object and opens the HTML
file, converts it to a Word doc and then creates a link to it.  The
problem I'm having is a bit odd...I can see that the doc is indeed getting
created in the right directory, it opens and displays exactly as expected
if I open it from the directory...but the link to the file doesn't open
the file...it simply hangs trying to open the doc.  Subsequent attempts to
open the file using the link results in a page not found error.

I have double, triple checked the directory to the file on the server,
that checks out okay.  The file does exist and opens fine when i navigate
to the drive that contains the directory.

Does anyone have any possible ideas of why the file wouldn't be opening
using a link?

COM Related Code:

$fileName = "testwrite.html";
$fp = fopen($fileName,"r+")or die("Could not open file");
fwrite($fp,$htmlContent);
fclose($fp);


$filePath = "D:/public/TatumPartnersQA/testwrite.html";

@$word = new COM("Word.Application") or die("Unable to instanciate Word");

$word->visible = 0;
$word->Options->ConfirmConversions = false;

$word->Documents->Open($filePath);
$word->Documents[1]->SaveAs('D:/public/WordResources/testwrite4.doc');
$word->Documents[1]->Close();
$word->Quit();
$word->Release();

echo "<a
href='http://www.tatumpartners.net/public/WordResources/testwrite2.doc'
target='_new'>word file</a>";

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux