[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

howto write rtf directly?

Nuralanur

6/9/2005 10:57:00 PM

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



3 Answers

Logan Capaldo

6/10/2005 12:36:00 AM

0

On 6/9/05, Nuralanur@aol.com <Nuralanur@aol.com> wrote:
> 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
>
>
>
>
>

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.


Thomas

6/10/2005 9:45:00 AM

0

Brian Schröder

6/10/2005 9:49:00 AM

0

On 10/06/05, Nuralanur@aol.com <Nuralanur@aol.com> wrote:
> 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
>
>

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

http://www.biblioscape.com/rtf1...

when I googled for rich text format.

regards,

Brian


--
http://ruby.brian-sch...

Stringed instrument chords: http://chordlist.brian-sch...