howto write rtf directly?

N

Nuralanur

-------------------------------1118357814
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Hello,

I would like to be able to write a Rich Text Format document, including
the format information, of course, using Ruby.
More precisely, what I need is to do the converse of what an RTF editor
does.
If you type into say Jarte,

black bold red and normal text

and you save that as an RTF document and you open it under SciTE,

that gives something like

{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Times
New Roman;}}
{\colortbl ;\red255\green0\blue0;}
\viewkind4\uc1\pard\f0\fs24 black \b bold \cf1 red\cf0\b0 and normal
text\par
}.

Now I would like to use Ruby to write the garbled text below into a file and
open
it with an RTF editor and see bold and colored text.
So far, I wrote the text below to a file with .rtf ending, but that just
shows
a text with all the garbage in it when opened with the RTF editor.
What is needed to make an RTF editor interpret the information correctly?

Thank you very much!

Axel




-------------------------------1118357814--
 
L

Logan Capaldo

Hello,
=20
I would like to be able to write a Rich Text Format document, including
the format information, of course, using Ruby.
More precisely, what I need is to do the converse of what an RTF editor
does.
If you type into say Jarte,
=20
black bold red and normal text
=20
and you save that as an RTF document and you open it under SciTE,
=20
that gives something like
=20
{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Tim= es
New Roman;}}
{\colortbl ;\red255\green0\blue0;}
\viewkind4\uc1\pard\f0\fs24 black \b bold \cf1 red\cf0\b0 and normal
text\par
}.
=20
Now I would like to use Ruby to write the garbled text below into a file = and
open
it with an RTF editor and see bold and colored text.
So far, I wrote the text below to a file with .rtf ending, but that just
shows
a text with all the garbage in it when opened with the RTF editor.
What is needed to make an RTF editor interpret the information correctly= ?
=20
Thank you very much!
=20
Axel
=20
=20
=20
=20
=20

Silly question, but judging by screenshots of Jarte you are on
windows. Are you sure the file extension was actually rtf? (and not
rtf.txt?). I know that has bitten me before.
 
T

Thomas

So far, I wrote the text below to a file with .rtf ending, but that just
shows
a text with all the garbage in it when opened with the RTF editor.

You want to write this text snippet into a file? Nothing else? Do the
backslashes appear properly in the written file?

Cheers,
Thomas.
 
B

Brian Schröder

Hello,
=20
I would like to be able to write a Rich Text Format document, including
the format information, of course, using Ruby.
More precisely, what I need is to do the converse of what an RTF editor
does.
If you type into say Jarte,
=20
black bold red and normal text
=20
and you save that as an RTF document and you open it under SciTE,
=20
that gives something like
=20
{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Tim= es
New Roman;}}
{\colortbl ;\red255\green0\blue0;}
\viewkind4\uc1\pard\f0\fs24 black \b bold \cf1 red\cf0\b0 and normal
text\par
}.
=20
Now I would like to use Ruby to write the garbled text below into a file = and
open
it with an RTF editor and see bold and colored text.
So far, I wrote the text below to a file with .rtf ending, but that just
shows
a text with all the garbage in it when opened with the RTF editor.
What is needed to make an RTF editor interpret the information correctly= ?
=20
Thank you very much!
=20
Axel
=20
=20

Don't know if it helps you, but google gave me the spezification at

http://www.biblioscape.com/rtf15_spec.htm

when I googled for rich text format.

regards,

Brian


--=20
http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,538
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top