Re: [PHP] Generating word documents based on fields in a browser

2002-07-11 Thread Michael Davey

 ?
 $word=new COM(word.application) or die(Cannot start MS Word);
 print Loaded word version ($word-Version)\n;
 $word-visible = 1 ;
 $word-Documents-Add();
 $word-Selection-Typetext(This is a test);
 ?

 does anyone recognise this?

Oh yes - this would be Word via COM - if you are having problems getting
this to work, I would suggest consulting the VBA reference manual that comes
with Office - it will give you the methods/objects available to you, as well
as examples of how to use them...

Mikey



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




Re: [PHP] Generating word documents based on fields in a browser

2002-07-11 Thread Craig

Thanks for all the info, i have found a temporary solution which i am
currently going to develop
If anyone is interested, I found the following at

http://www.pscode.com/xq/ASP/txtCodeId.625/lngWid.8/qx/vb/scripts/ShowCode.h
tm

Thanks Again

Craig



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




Re: [PHP] Generating word documents based on fields in a browser

2002-07-10 Thread René Moonen

Is this what you mean?


?php
header(Content-type: application/rtf);
echo Hello World;
?

René


Craig wrote:

Is this possible
I want to create a form, similar to an invoicing system that generates a
word document that the user can print out

Any help would be gratefully appreciated.

craig



  




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




Re: [PHP] Generating word documents based on fields in a browser

2002-07-10 Thread David Otton

On Wed, 10 Jul 2002 15:53:36 +0100, you wrote:

I want to create a form, similar to an invoicing system that generates a
word document that the user can print out

You may have better luck with RTF
(http://www.phpbuilder.com/columns/nair20020523.php3) or PDF
(http://www.php.net/manual/en/ref.cpdf.php)...

(but what can the Word format do that HTML can't? Why can't they print
out an HTML invoice?)


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




Re: [PHP] Generating word documents based on fields in a browser

2002-07-10 Thread Craig

I know that php can open files.
What I was wondering is if it can :-
Start Word
Open a Word template
Generate fields in the template based on hidden fields and generate the page


David Otton [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Wed, 10 Jul 2002 15:53:36 +0100, you wrote:

 I want to create a form, similar to an invoicing system that generates a
 word document that the user can print out

 You may have better luck with RTF
 (http://www.phpbuilder.com/columns/nair20020523.php3) or PDF
 (http://www.php.net/manual/en/ref.cpdf.php)...

 (but what can the Word format do that HTML can't? Why can't they print
 out an HTML invoice?)




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




Re: [PHP] Generating word documents based on fields in a browser

2002-07-10 Thread David Otton

On Wed, 10 Jul 2002 16:13:53 +0100, you wrote:

David Otton [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Wed, 10 Jul 2002 15:53:36 +0100, you wrote:

 I want to create a form, similar to an invoicing system that generates a
 word document that the user can print out

 You may have better luck with RTF
 (http://www.phpbuilder.com/columns/nair20020523.php3)

[hint: Word can read RTF files]

 (but what can the Word format do that HTML can't? Why can't they print
 out an HTML invoice?)

I know that php can open files.
What I was wondering is if it can :-
Start Word
Open a Word template
Generate fields in the template based on hidden fields and generate the page

Yeuch. Maybe. Ask a Word expert if it's possible to manipulate it in
that way. But you're better off modifying the file yourself in PHP,
not asking Word to do it for you.

But again, /why/? What benefit does this get you that's not offered by
regular HTML?


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




Re: [PHP] Generating word documents based on fields in a browser

2002-07-10 Thread Craig

I need to be able to keep a record of documents created.

I have found this but failed to get it to work

?
$word=new COM(word.application) or die(Cannot start MS Word);
print Loaded word version ($word-Version)\n;
$word-visible = 1 ;
$word-Documents-Add();
$word-Selection-Typetext(This is a test);
?

does anyone recognise this?



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




Re: [PHP] Generating word documents based on fields in a browser

2002-07-10 Thread Chris Hewitt

Craig,

Its not PHP but HTML. I do this for a client. Make a Word document as 
needed, save it as rtf. Put a link onto my html page calling a 
particular routine. The routine reads the .rtf file, looking for 
replaceable parameters, replacing them with the customised values for 
this customer and saves the file under a new name indicating it is for 
this customer (still .rtf).

A new page has a link to this new file. When the user clicks it, as 
their browser has the mime type for .rtf set to MS Word, Word starts up 
and opens the file.

OK, in the application I did this in I used pl/sql (as the database was 
Oracle and there was no php) but there is no reason why you should not 
write a php routine to replace the parameters and resave the file.

HTH
Chris

Craig wrote:

I know that php can open files.
What I was wondering is if it can :-
Start Word
Open a Word template
Generate fields in the template based on hidden fields and generate the page




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




Re: [PHP] Generating word documents based on fields in a browser

2002-07-10 Thread Chris Earle

Ya, I did it with ASP (customer requested) about 2 months ago...

Chris Hewitt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Craig,

 Its not PHP but HTML. I do this for a client. Make a Word document as
 needed, save it as rtf. Put a link onto my html page calling a
 particular routine. The routine reads the .rtf file, looking for
 replaceable parameters, replacing them with the customised values for
 this customer and saves the file under a new name indicating it is for
 this customer (still .rtf).

 A new page has a link to this new file. When the user clicks it, as
 their browser has the mime type for .rtf set to MS Word, Word starts up
 and opens the file.

 OK, in the application I did this in I used pl/sql (as the database was
 Oracle and there was no php) but there is no reason why you should not
 write a php routine to replace the parameters and resave the file.

 HTH
 Chris

 Craig wrote:

 I know that php can open files.
 What I was wondering is if it can :-
 Start Word
 Open a Word template
 Generate fields in the template based on hidden fields and generate the
page
 





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