VBScript - TO - PHP... Open-Method-COM+

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

 



Hi again
 
I don't know If I figure out exactly how to "convert" VB-application to PHP-code...
I'm using the reference:http://msdn2.microsoft.com/en-us/library/aa220317(office.11).aspx
(Because I'm using Word 2003 as test-application)

 
And viewing example: "As it applies to Document-object"


 


And I think THIS would be done like this in PHP ? 
(I get the following error: I'm using MS Word 11.0
Fatal error: Uncaught exception 'com_exception' with message 'Unable to lookup `Open': Okänt namn. ' in C:\www\testword2.php:22 Stack trace: #0 C:\www\testword2.php(22): unknown() #1 {main} thrown in C:\www\testword2.php on line 22)Okänt namn = unkown name



(The test.doc exists) 
<?php
$word = new COM("Word.Application");
//To see the version of Microsoft Word, just use $word->Version
echo "I'm using MS Word {$word->Version}";
//It's better to keep Word invisible
$word->Visible = 1;
//Creating new document
$word->Documents->Add();
 
  

//Setting 2 inches margin on the both sides
$word->Selection->PageSetup->LeftMargin = '2"';
$word->Selection->PageSetup->RightMargin = '2"';
//Setup the font
$word->Selection->Font->Name = 'Verdana';
$word->Selection->Font->Size = 16;
 
$doc = $word->Selection->Document;
$docName = "c:\\www\\test.doc";
$doc->Open($docName);
 
 
 
?>


What am I doing wrong/thinking wrong?  


Best regards
/Gustav Wiberg


No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.488 / Virus Database: 269.14.5/1058 - Release Date: 2007-10-08 16:54
 

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