trichview.com

trichview.support




Re: Delete color style information from text


Return to index


Author

Message

Christian Kirchhoff

Posted: 04/17/2003 14:09:17


Thanks for your help, Sergey.


I have one additional question: When I search and find  the tag that has

to be replaced, it is automatically selected in the RichViewEditor. Now I

can determine the font color easily. Isn't there a way to insert the new

text from a stream and thenselect this inserted text. This way I could assign

the color to the selected text and wouldn't have to use another invisible

RichViewEditor.

The way I could image to do it would be:

- search the tag

- determine the color

- delete the tag

- save the caret position (GetSelectionBounds)

- insert the new text from stream. The caret is positioned at the end of

the inserted text afterwards, isn't it?

- select text from here to formerly saved caret position (i.e. beginning

of inserted text)

- assign color to this selection


But I don't know if the item numbering changes when I call InsertRVFFromStreamEd.

If it does, I cannot store the caret position before inserting the new text

and thus I would now where the start of the inserted text would be.

If - on the other hand - the item numbering stays accurate after inserting

the new text, I would do it as described above.


I'm a little anxious of using another invisible RichViewEditor and RVStyle

component, because my application is using many ressources which can cause

problems under Windows 98. I wouldn't like to need and use even more ressources.


What would you suggest?


Regards,


Christian



"Sergey Tkachenko" <[email protected]> wrote:

>The only idea that I can suggest - load copied document to some temporal

>invisible RichView (linked to unique RVStyle), change color to the desired

>color (for i := 0 to rvstyle.textstyles.count-1 do

>rvstyle.textstyles[i].Color := newcolor, where rvstyle is a TRVStyle

>component linked to this invisible RichView), then copy it back to stream

>and then insert.

>

>>

>> Hello,

>>

>> in my project I have certain "template files" which are opened with a

>TRichViewEdit.

>> In this file there are my own "Tags" (e.g. "{description}"), which are

>searched

>> and replaced which actual texts. I do this with

>RichViewEditor.InsertRVFFromStreamEd,

>> because the text that is inserted can contain certain text or paragraph

>styles

>> as well. These styles are bold, italic, some list styles, but never the

>font

>> name, size or color. Those values should always be "default".

>>

>> I have a template editor, which alloes me to edit the texts, set certain

>> text ar paragraph attributes.

>> Now I could for example set the font color of "{description}" to clWhite.

>> But when I insert the RVF stream, the font color always changes to black,

>> because this seems to be stored inside the RVF stream. I tried setting

the

>> color of the RVF text that will be inserted to clNone, but that doesn't

>work.

>> How can I insert a text with certain attributes, but without font name,

>color

>> or size?

>>

>> Regards,

>>

>> Christian Kirchhoff

>

>





Powered by ABC Amber Outlook Express Converter