P
Patrick Porter
I am looking at followin the suggestion made by Larry on my last post. (his
reply is on the bottom) it seems that you can't directly mess with the rich
text header text....specifically the addtion of the colortable (which
defines which colors can be used)
rtbCode.Rtf.Insert(10,"{\colortbl
;\red255\green0\blue0;\red0\green0\blue255;}")
does nothing.
neither does rewrting the entire header each time.... why is this? In order
for me to add color, i have to have a color table written at the beginning.
once again i turn to you all for help.
thanks, patrick
-------------------------------------------------------->
(Larrys post:
The RichTextBox offers a property called Rtf which gets/sets the actual
rich text as a String. If you look at this you will see stuff like
this:
this is normal text
\b this is bold
\i this is italic
I'm not sure what the exact syntax is, but basically this is how rich
text works - by inserting formatting instructions into the regular text
(like a primitive form of HTML if you like). You could try obtaining
the string from .Rtf, parsing it for 'ax', inserting the appropriate
formatting codes, then writing it back to .Rtf. This should avoid the
problems you get when you change the Selection.
To find out what the right control codes are, use WordPad to create a
..rtf file and examine that file using Notepad.
reply is on the bottom) it seems that you can't directly mess with the rich
text header text....specifically the addtion of the colortable (which
defines which colors can be used)
rtbCode.Rtf.Insert(10,"{\colortbl
;\red255\green0\blue0;\red0\green0\blue255;}")
does nothing.
neither does rewrting the entire header each time.... why is this? In order
for me to add color, i have to have a color table written at the beginning.
once again i turn to you all for help.
thanks, patrick
-------------------------------------------------------->
(Larrys post:
The RichTextBox offers a property called Rtf which gets/sets the actual
rich text as a String. If you look at this you will see stuff like
this:
this is normal text
\b this is bold
\i this is italic
I'm not sure what the exact syntax is, but basically this is how rich
text works - by inserting formatting instructions into the regular text
(like a primitive form of HTML if you like). You could try obtaining
the string from .Rtf, parsing it for 'ax', inserting the appropriate
formatting codes, then writing it back to .Rtf. This should avoid the
problems you get when you change the Selection.
To find out what the right control codes are, use WordPad to create a
..rtf file and examine that file using Notepad.