Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

saving as a .doc?

by coldfingertips (Pilgrim)
on Feb 05, 2004 at 04:16 UTC ( [id://326677]=perlquestion: print w/replies, xml ) Need Help??

coldfingertips has asked for the wisdom of the Perl Monks concerning the following question:

I have a client that wants form data written as a doc then sent as an attachment instead of just sending the form data as text. I can probably figure out how to send attachments with Mail::Mailer, but I don't know how OR if it's even possible to write a .doc file (the client doesn't want a .txt and I'm not exactly sure if I can just use the extension and have it read as a document).

Any information on this you can give me would be very much appreciated.

Replies are listed 'Best First'.
Re: saving as a .doc?
by matthewb (Curate) on Feb 05, 2004 at 06:39 UTC

    Open a file called `whatever.doc' and use RTF::Writer to populate it with your client's data.

    MB
Re: saving as a .doc?
by neuroball (Pilgrim) on Feb 05, 2004 at 04:33 UTC
      I think a few of the folks are on the right track. Actually, if they don't care about formatting, you can just save a plain ASCII file but using a .doc extension. When your client gets it, Word will open it. Not pretty, but easy. Otherwise I'd go with matthewb's or MCS's suggestion about the RTF modules. And as far as mailing the attachment, Mail::Mailer may work - I've also had great luck with MIME::Lite.
Re: saving as a .doc?
by Zero_Flop (Pilgrim) on Feb 05, 2004 at 05:19 UTC
    Platform?

    If Win then you could use OLE.
    If Linux/Unix you will have to go with OpenOffice as suggested.
Re: saving as a .doc?
by MCS (Monk) on Feb 05, 2004 at 16:53 UTC

    First, you need to specify a little more. First, if this is all hapening on Windows, you can look at Win32::OLE

    However, if these forms you are talking about are web forms running on say UNIX, there is no way (as far as I know) to create a .doc using perl. Open Office may work but I don't know if you can automate it in perl or not.

    Perhaps you may want to look at using something like an .rtf file instead of a word file so you could use something like RTF::Document and your client can still open it in word and have formatting.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://326677]
Approved by neuroball
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-16 19:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found