Re: How to convert plain ASCII text file to RTF?

From: Steven J Masta (smasta_at_earthlink.net)
Date: 12/30/04


Date: Thu, 30 Dec 2004 03:21:40 GMT

On Wed, 29 Dec 2004 11:38:18 -0800, tinyurl.com/uh3t wrote:

> I have a file in plain text format, and I need to e-mail it to somebody
> who accepts only MS-Word and RTF. Obviously there's no way to create a
> MS-Word file here on Unix, so I need a way to convert the file to RTF. Is
> there any Unix utility that would do that automatically? Alternately, does
> anybody know what minimal RTF header etc. I can manually add with a text
> editor to fake a minimal RTF file?
>
> I did a Google search but the closest I could find was a java program to
> write a "hello world" RTF file, but it wouldn't compile because it
> required classes such as com.lowagie.text.Document which are not in the
> standard java 1.2.2 distribution here on this FreeBSD 4.10-STABLE ISP.
>
> I found the RTF 1.5 specification, but it's very large, with many header
> fields, but no idea what the minimal header would be nor how to specify
> plain text fixed-pitch font with everything pre-formatted with hard
> newlines so that I could just stick a header in front of the plain-text
> file to make it work as RTF.

Check out http://freshmeat.net/projects/text2rtf/
 If you're not expecting much, you won't be disappointed.

It seems to just add:

{\rtf1\mac\ansicpg10000\cocoartf102
{\fonttbl\f0\froman\fcharset77 Times-Roman;}
\f0\fs24

as a header then \par at the beginning of each line (except the first one
of course)

Have fun
Steve



Relevant Pages

  • Re: How to load rtf in richtextbox with header and footer
    ... RTF codes that specify a header and footer to work inside a RichTextBox? ... That _does_ operate basically on a page level, and if you embed it into your own control that could produce the visual results you're looking for. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: RTF parsing
    ... you definely need to parse the RTF file ... For example the header should always end before the document begins ... footer it will not be automatically handled. ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: RTF parsing
    ... I am trying to create a RTF parser which can automatically recoganize ... the header and footer. ... footer it will not be automatically handled. ... But if say customer uses two lines of header ...
    (borland.public.delphi.thirdpartytools.general)
  • RTF parsing
    ... the header and footer. ... Infact one of my client uses our converstion software which converts ... RTF to PDF. ... footer it will not be automatically handled. ...
    (borland.public.delphi.thirdpartytools.general)
  • parsing RTF header and footer
    ... the header and footer. ... Infact one of my client uses our converstion software which converts ... RTF to PDF. ... footer it will not be automatically handled. ...
    (borland.public.delphi.thirdpartytools.general)