Change background colour keywords

General TRichView support forum. Please post your questions here
Post Reply
jfleming
Posts: 19
Joined: Tue May 25, 2010 4:58 pm

Change background colour keywords

Post by jfleming »

We are new to TRichView and are getting ready to incorporate a trimmed-down version of the ActionsTest demo program editor into our application as our Rich Text editor.

When using your ActionsTest demo temporarily as a surrogate editor to perform other suitability / risk reduction tests we encountered the following problem:

- The Rich Text stored in the database will be presented as one of several columns in an InfoPower grid. The remaining columns are "normal" numeric, date and string columns. The Rich Text component of that grid uses the Microsoft Version 3 Rich Edit dll.
- To edit the Rich Text, the user will double-click the grid cell and the TRichView editor will pop up. We will first insert the database contents into that non-data-aware TRichView and the modified rich text will later be extracted and inserted into the database, thereby becoming visible in the grid cell.
- The RTF code generated by the TRichView for a piece of text whose background colour has been set by the user is:

words with \plain \f0\fs20\chcbpat7 background colour\plain \f0\fs20 changed,

This uses the "\chcbpat<N>" keyword followed by the "\plain" keyword. The InfoPower grid does not recognise that keyword, and ignores it, so the text background colour is not painted. The InfoPower grid does, however, correctly handle a "\highlight" keyword.

How can I configure the TRichView so that it generates either of the following RTF code sequences using the "\highlight<N>" keyword:

words with \plain \f0\fs20\highlight7 background colour\highlight0 \f0\fs20 changed,

words with \plain \f0\fs20\highlight7 background colour\plain \f0\fs20 changed,

Or is there some other way of doing this, maybe using Events ???

Or does someone know of a more capable grid that can handle more advanced Rich Text than the two we know: TwwDBRichEdit from InfoPower and TLMDDBRichEdit from LMDInnovative ??

Our requirements are: character formatting (bold, italics, underline, foreground and background colouring), multi-level bulleting and numbered lists (numbers and letters), and paragraph formatting limited to alignment left and right, indentation left and right, and single or 1.5 line spacing within and between paragraphs.

Thanking you in advance

---
JF
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I'll add an option in the next update.
jfleming
Posts: 19
Joined: Tue May 25, 2010 4:58 pm

Post by jfleming »

Sergey,

As I understand it, the three keywords have different uses, and so probably require separate Standard Actions to implement them:

\chcbpat Background Pattern is for use when the user wants some background shading allied maybe with a different background colour. Shading could be a cross-hatching pattern, or diagonal lines, with or without a shading colour.

\cb Colour Background. The twin of \cf: colour foreground. Is used when the user changes the background colour of the text.

\highlight Highlight is for use when the user presses a Highlight key ??

For the time being we have decided to extract the RTF text from the TRichView into a string variable, change \chcbpat to \highlight, transfer the string variable to a TMemoryStream and stream the text into the TwwDBRichEdit embedded in the grid. In tests this has worked correctly.

The sophistication of the TRichView and the RTF it can generate is quite amazing, with handling of styles, hyperlinks, images, tables, etc. -- way above what is available from InfoPower and LMD.

In tests, the RTF code created by TRichView was correctly displayed by a TwwDBRichEdit for all but tables and paragraph borders. Fast-Reports also correctly printed the text, with those same deficiencies.

--
JF
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

- \chcbpat defines a background color as a character attribute.
- \cb is the same (according to the RTF specification), but it is not supported by MS Word, and AFAIK nobody uses it;
- \highlight is not a character attribute, it is considered as something applied over the text.

This is according to the RTF specification. However, as I can see, \plain keyword resets not only character attributes, but \highlight as well.
So, it looks like, on practice, there is no difference between \chcbpat and \highlight in MS Word.
(Well, \chcbpat can be used with \chcfpat to create a background pattern; And highlight can be applied on top of background color. But TRichView does not support these features.)

So, as I understand, I can simply change \chcbpat to \highlight in TRichView output, as an option.
Post Reply