php-windows Digest 10 Oct 2007 06:23:38 -0000 Issue 3345

Topics (messages 28532 through 28537):

VBScript - TO - PHP... Open-Method-COM+
        28532 by: Gustav Wiberg
        28533 by: Niel Archer
        28534 by: Gustav Wiberg

Authentication Question!
        28535 by: Matthew Gonzales
        28536 by: Mazzu
        28537 by: Gustav Wiberg

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


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

--- End Message ---
--- Begin Message ---
Hi

  First off, let me say I don't use Word, don't even have it installed
on my computers, so I can't test any of this.

  You seem to be doing unnecessary stuff to open one document (adding a
new one that's not used after). Have you looked at PHP's online
documentation for .COM (http://www.php.net/manual/en/ref.com.php). It
has some excellent comments and examples from other users, one of which
I reproduce below.

an easy way to convert your file from .doc to .html

// 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("E:\\first.doc");

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

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

//free the object from the memory
$word->Release();
$word = null;


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

--
Niel Archer

--- End Message ---
--- Begin Message ---
Hi!

Aha. Ok. I used
$word->Selection->Documents->Open("c:\\www\\test.doc");
 instead of
$word->Documents->Open("c:\\www\\test.doc");

Thanx!

/Gustav


-----Original Message-----
From: Niel Archer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 09, 2007 11:13 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] VBScript - TO - PHP... Open-Method-COM+

Hi

  First off, let me say I don't use Word, don't even have it installed
on my computers, so I can't test any of this.

  You seem to be doing unnecessary stuff to open one document (adding a
new one that's not used after). Have you looked at PHP's online
documentation for .COM (http://www.php.net/manual/en/ref.com.php). It
has some excellent comments and examples from other users, one of which
I reproduce below.

an easy way to convert your file from .doc to .html

// 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("E:\\first.doc");

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

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

//free the object from the memory
$word->Release();
$word = null;


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

--
Niel Archer

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


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
 

--- End Message ---
--- Begin Message ---
Hello,

Could some one offer their opinion one which is better to use when creating a password protected area, a $Cookie or a $Session. I have found alot of info on both and can't really make up my mind. I am running PHP and MySQL on IIS 6.0.

Matt G

--
Matthew Gonzales
IT Professional Specialist
Enterprise Information Technology Services
University of Georgia
Email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Phone: (706)542-9538

--- End Message ---
--- Begin Message ---
Matthew Gonzales <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Could some one offer their opinion one which is better to use when 
> creating a password protected area, a $Cookie or a $Session. I have 
> found alot of info on both and can't really make up my mind. I am 
> running PHP and MySQL on IIS 6.0.
>
> Matt G
>


Commonly people use sessions. It's designed for this kind of purpose.
But sessions use cookies (one cookie).

More info :
http://www.php.net/session
http://shiflett.org/articles/the-truth-about-sessions

--- End Message ---
--- Begin Message ---
Hi!

For higher security it's generally better to use Sessions BECAUSE Cookies 
generally stores files on the client hd for a longer time, and it's therefore 
easier to get the password (if the password itself is not encrypted). My tip is 
to use sessions if it works. Uses cookies in other hand (It depends of the 
application what you need)

Best regards
/Gustav Wiberg
 

-----Original Message-----
From: Matthew Gonzales [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 09, 2007 8:23 PM
To: PHP-Windows Group
Subject: [PHP-WIN] Authentication Question!

Hello,

Could some one offer their opinion one which is better to use when 
creating a password protected area, a $Cookie or a $Session. I have 
found alot of info on both and can't really make up my mind. I am 
running PHP and MySQL on IIS 6.0.

Matt G

-- 
Matthew Gonzales
IT Professional Specialist
Enterprise Information Technology Services
University of Georgia
Email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Phone: (706)542-9538

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


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
 

--- End Message ---

Reply via email to