Formatting Text From A Stored Procedure (OpenInsight Specific)
At 18 FEB 1999 07:22:49PM Greg James, ISIS, Inc. wrote:
I am trying to format text from within a stored procedure. Normally I would simply set the FONT property for the control, but I only want to change properties for certain characters in the string of text.
For example,
If I have….
Var_1=Open'
Var_2=Insight'
Var_3=for Workgroups'
TxtStrng=This program was written in ':Var_1:' ':Var_2:' ':Var_3:'.'
Set_Property(@Window:'.SOME_EDITLINE_CTRL','TEXT',TxtStrng)
How could I programmatically set Var_1 and Var_3, for example, to bold and/or italic before I set the editline control's text property?
Thanks,
Greg James
At 19 FEB 1999 08:34AM Oystein Reigem wrote:
Greg,
I am trying to format text from within a stored procedure. Normally I would simply set the FONT property for the control, but I only want to change properties for certain characters in the string of text. … How could I programmatically set Var_1 and Var_3, for example, to bold and/or italic before I set the editline control's text property?
You can't.
But you can do it with an edit box. Tick Rich Text in Edit Box Properties and you get a read-only edit box where you can put RTF-formatted text. Except it's only a subset of Rich Text Format, and strictly 7-bit characters.
(The following features work in RTF edit boxes: Fonts, font sizes, styles (italics, bold, normal), colour, underline. The following do not work: Caps, strikethrough, dotted and double underline, background and highlight colours, bullets, indent, margins, spacing, tables. You can use tabs, but no fancy stuff, and you cannot not define the tab positions in RTF. I assume lists don't work.)
Try to set the TEXT of your edit box to the following string. You might have to keep the line breaks (use Char(13):Char(10)). Some of them seem to be significant:
{\rtf1\ansi\ansicpg1252\uc1
{\fonttbl
{\f1\froman\fcharset0 Courier New;}
}
{\fonttbl
{\f2\froman\fcharset0 Times New Roman;}
}
{\colortbl;
\red0\green0\blue0;
\red0\green0\blue255;
\red0\green255\blue255;
\red0\green255\blue0;
\red255\green0\blue255;
\red255\green0\blue0;
\red255\green255\blue0;
\red255\green255\blue255;
\red0\green0\blue128;
\red0\green128\blue128;
\red0\green128\blue0;
\red128\green0\blue128;
\red128\green0\blue0;
\red128\green128\blue0;
\red128\green128\blue128;
\red192\green192\blue192; }
\pard
\plain
\f1
\fs20
This displays in 10 pt regular Courier New.
\par
Here's something in {\i italics} and {\b bold}.
\par
Now I'll try out various foreground colours:
\par
{\cf1 A}
{\cf2 A}
{\cf3 A}
{\cf4 A}
{\cf5 A}
{\cf6 A}
{\cf7 A}
{\cf8 A}
{\cf9 A}
{\cf10 A}
{\cf11 A}
{\cf12 A}
{\cf13 A}
{\cf14 A}
{\cf15 A}
{\cf16 A}
\par
Let's go down to {\fs10 5 points} and up to {\fs40 20 points} before returning to normal.
\par
{\fs40 Changing the font to 20 points in the middle of a text didn't quite work. Is this better?}
\par
What about {\ul underlining a few words}?
\par
Now for that {\f2 other font - Times New Roman}. And back to Courier New again.
\par
}
- Oystein -