I don't have any special formatting going into the file. It's just plain old text. How do I go about doing this?

There are some ways to use Win32:OLE and other techniques to generate a fancy MS .doc file. But from the above, you say that this is just plain old text. To me that means no fancy formatting, font selections, etc.

If you really just have "plain old text", then just make file: plain_old_text.doc with some plain old text in it. I just renamed one of my .pl programs to .doc as a test case. When WinWord opens plain_old_text.doc, it will say that it is plain text and user just has to click "yes" to read it (does a conversion). default fonts wind up on my machine as Courier New, 10 pt. So if it is indeed just text, Winword will read that "sort of .doc file" and convert it to a "real" .doc file just like as an analogy, Excel can import CSV files.

The WinWord.doc format is complex and I don't think that there are any options for a "real" .doc file that can be read by multiple years of WinWord other than using a version WinWord to make it (WinWord can be controlled by Perl but I've never actually done it myself).

Update: I did get a transient cannot open mswrd632.wpc error when I did the above experiment, but WinWord 2000 asked for my CD and became happier after that. Anyway my .pl file renamed to a .doc file did open in WinWord 2000.


In reply to Re: Help generating MS Word .doc file from perl by Marshall
in thread Help generating MS Word .doc file from perl by schick79

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.