Creating Word Documents with Perl

Discussion in 'Perl Misc' started by amerar@iwc.net, Apr 6, 2007.

  1. Guest

    Hi All,

    I need to create a Microsoft Word document on Perl. This will be on
    a Linux Box.

    The actual process is, I need the script to query a MySQL database and
    get the data for the Word document, create the document, and email it.

    The first and last steps are easy. I am lost on how to create the
    Word document. And, as I mentioned, this is on a Linux box, not a
    Windows box.....

    Can anyone help???

    Thanks!!

    Art
     
    , Apr 6, 2007
    #1
    1. Advertising

  2. Guest

    On Apr 6, 10:32 am, Michele Dondi <> wrote:
    > On 6 Apr 2007 07:49:51 -0700, "" <> wrote:
    >
    > >I need to create a Microsoft Word document on Perl. This will be on
    > >a Linux Box.

    >
    > >The actual process is, I need the script to query a MySQL database and
    > >get the data for the Word document, create the document, and email it.

    >
    > >The first and last steps are easy. I am lost on how to create the
    > >Word document. And, as I mentioned, this is on a Linux box, not a
    > >Windows box.....

    >
    > I believe that there are ways to do this, with Windows-specific
    > modules. Unfortunately this path won't work from Linux, unless by
    > means of some arcane trickery, but I doubt that. However is there any
    > compelling reason why the documents *must* be in M$ Word? Are they
    > meant to be edited? If not, you may consider e.g. nicely typeset
    > pdf's...
    >
    > Michele
    > --
    > {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    > (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    > .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    > 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


    Basically what need is to prepare a nicely formatted document that
    will be emailed. So, I'll need to create a document that will be an
    email attachment, and, it needs to have different size fonts and
    such. I can do this with an HTML document........

    Perhaps that is the way to do it? Maybe create an HTML document, and
    have them open it in IE or Firefox and print it???
     
    , Apr 6, 2007
    #2
    1. Advertising

  3. Scott Bryce Guest

    wrote:

    > Basically what need is to prepare a nicely formatted document that
    > will be emailed. So, I'll need to create a document that will be an
    > email attachment, and, it needs to have different size fonts and
    > such. I can do this with an HTML document........


    I'd go with PDF. You can take your question over to comp.text.pdf and
    see if they can give you some pointers.

    > Perhaps that is the way to do it? Maybe create an HTML document, and
    > have them open it in IE or Firefox and print it???


    It depends on how important the page formatting is.
     
    Scott Bryce, Apr 6, 2007
    #3
  4. Brian Wakem Guest

    wrote:

    > On Apr 6, 10:32 am, Michele Dondi <> wrote:
    >> On 6 Apr 2007 07:49:51 -0700, "" <> wrote:
    >>
    >> >I need to create a Microsoft Word document on Perl. This will be on
    >> >a Linux Box.

    >>
    >> >The actual process is, I need the script to query a MySQL database and
    >> >get the data for the Word document, create the document, and email it.

    >>
    >> >The first and last steps are easy. I am lost on how to create the
    >> >Word document. And, as I mentioned, this is on a Linux box, not a
    >> >Windows box.....

    >>
    >> I believe that there are ways to do this, with Windows-specific
    >> modules. Unfortunately this path won't work from Linux, unless by
    >> means of some arcane trickery, but I doubt that. However is there any
    >> compelling reason why the documents *must* be in M$ Word? Are they
    >> meant to be edited? If not, you may consider e.g. nicely typeset
    >> pdf's...
    >>
    >> Michele
    >> --
    >> {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    >> (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    >> .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    >> 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

    >
    > Basically what need is to prepare a nicely formatted document that
    > will be emailed. So, I'll need to create a document that will be an
    > email attachment, and, it needs to have different size fonts and
    > such. I can do this with an HTML document........



    If you rename somefile.html to somefile.doc, it will open in Word
    automatically[1] and user wont even know it is HTML.


    [1] assuming Word is installed and is the default for opening files with
    the .doc extension.

    --
    Brian Wakem
    Email: http://homepage.ntlworld.com/b.wakem/myemail.png
     
    Brian Wakem, Apr 6, 2007
    #4
  5. Amer Neely Guest

    wrote:
    > On Apr 6, 10:32 am, Michele Dondi <> wrote:
    >> On 6 Apr 2007 07:49:51 -0700, "" <> wrote:
    >>
    >>> I need to create a Microsoft Word document on Perl. This will be on
    >>> a Linux Box.
    >>> The actual process is, I need the script to query a MySQL database and
    >>> get the data for the Word document, create the document, and email it.
    >>> The first and last steps are easy. I am lost on how to create the
    >>> Word document. And, as I mentioned, this is on a Linux box, not a
    >>> Windows box.....

    >> I believe that there are ways to do this, with Windows-specific
    >> modules. Unfortunately this path won't work from Linux, unless by
    >> means of some arcane trickery, but I doubt that. However is there any
    >> compelling reason why the documents *must* be in M$ Word? Are they
    >> meant to be edited? If not, you may consider e.g. nicely typeset
    >> pdf's...
    >>
    >> Michele
    >> --
    >> {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    >> (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    >> .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    >> 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

    >
    > Basically what need is to prepare a nicely formatted document that
    > will be emailed. So, I'll need to create a document that will be an
    > email attachment, and, it needs to have different size fonts and
    > such. I can do this with an HTML document........


    Have you looked at the 'format' command in perl? I've done some pretty
    nifty emails using it, and you don't need to attach anything - it's all
    inline.

    --
    Amer Neely
    w: www.softouch.on.ca/
    Perl | MySQL programming for all data entry forms.
    "We make web sites work!"
     
    Amer Neely, Apr 7, 2007
    #5
  6. Mumia W. Guest

    On 04/06/2007 11:21 AM, wrote:
    >
    > Basically what need is to prepare a nicely formatted document that
    > will be emailed. So, I'll need to create a document that will be an
    > email attachment, and, it needs to have different size fonts and
    > such. I can do this with an HTML document........
    >
    > Perhaps that is the way to do it? Maybe create an HTML document, and
    > have them open it in IE or Firefox and print it???
    >
    >


    I believe that modern versions of MS Word are supposed to import HTML
    documents easily, so that seems like the best option for you.
     
    Mumia W., Apr 7, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Zak Chababe

    convert word documents using Perl

    Zak Chababe, Jul 12, 2003, in forum: Perl
    Replies:
    0
    Views:
    1,355
    Zak Chababe
    Jul 12, 2003
  2. enak

    Creating Word documents on page

    enak, Oct 24, 2003, in forum: ASP .Net
    Replies:
    11
    Views:
    620
    Guest
    Nov 5, 2003
  3. Brian Cryer

    Creating Word Documents

    Brian Cryer, Feb 1, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    332
    Mark Rae
    Feb 1, 2007
  4. Tom
    Replies:
    2
    Views:
    135
  5. Tony
    Replies:
    2
    Views:
    390
Loading...

Share This Page