trichview.com

trichview.support




Re: problems in DBRichViewEdit and the first line


Return to index


Author

Message

Jamie

Posted: 12/04/2002 0:08:42


Very good! Thanks, and I'll switch to using Memory Streams, thatnks for that

advise too!



"Sergey Tkachenko" <svt@trichview.com> wrote in message

news:3ded3885$1@support.torry.net...

> Some methods (introduced in TCustomRichView, such as LoadRTF, AddNL) add

> items to the end of the document.

> Some methods (introduced in TCustomRichView, such as InsertRTFFromFileEd,

> InsertText) insert items at the position of caret (beginning of the

> document, if called after Format).

> There are 2 special methods: InsertRVF and InsertRVFFromStream - they

insert

> items in the given place.

>

> Despite their names, LoadRTF and LoadText do not clear document - they

> append loaded file to the end of the document, thus allowing to create

> document consisting of several files:.

>

> with EMailForm.rve do begin

>   Clear;

>   LoadRTF('C:\Header.rtf');

>   AddNL('',0,0);

>   AddNL('',0,0);

>   AddNL(DM.OfferFaxQuery.FieldByName('Title').AsString,0,1);

>   AddNL('',0,0);

>   AddNL('',0,0);

>   LoadRTF('C:\Footer.rtf');

>   Format;

> end;

>

> Use AddTextNL to add text containing several lines.

>

> It's better to use memory streams instead of files:

>

> var stream: TMemoryStream;

>

>  EMailForm.rve.Clear;

>

>  Stream := TMemoryStream.Create;

>  SettingsForm.Headerrve.SaveRVFToStream(Stream, False);

>  Stream.Position := 0;

>  EMailForm.rve.InsertRVFFromStream(Stream, EMailForm.rve.ItemCount);

>  Stream.Free;

>

>   EMailForm.rve.AddNL('',0,0);

>   EMailForm.rve.AddNL('',0,0);

>   EMailForm.rve.AddNL(DM.OfferFaxQuery.FieldByName('Title').AsString,0,1);

>   EMailForm.rve.AddNL('',0,0);

>   EMailForm.rve.AddNL('',0,0);

>

>  Stream := TMemoryStream.Create;

>  SettingsForm.Footerrve.SaveRVFToStream(Stream, False);

>  Stream.Position := 0;

>  EMailForm.rve.InsertRVFFromStream(Stream, EMailForm.rve.ItemCount);

>  Stream.Free;

>

>   EMailForm.rve.Format;

>

>

>

>

>

>

> > Well, I'm having trouble with that method too... What I really want to

do

> is

> > load a standard "Header" that is stored in a database, then insert some

> > lines of text, maybe a table, and then a footer, also stored in a

database

> > field... When I use LoadRTF, and then do an Insert Text, the text is

> > inserted before the header...??? instead of after like I would think...

> > Here's my code again

> >

> >   SettingsForm.Headerrve.SaveRTF('C:\Header.rtf',False);

> >   SettingsForm.Footerrve.SaveRTF('C:\Footer.rtf',False);

> >

> >   EMailForm.rve.Clear;

> >   EMailForm.rve.InsertTextFromFileED('C:\Header.rtf');

> >   EMailForm.rve.Format;

> >

> >   EMailForm.rve.AddNL('',0,0);

> >   EMailForm.rve.AddNL('',0,0);

> >

EMailForm.rve.AddNL(DM.OfferFaxQuery.FieldByName('Title').AsString,0,1);

> >   EMailForm.rve.Format;

> >

> >

> > Can you point me in the right direction? thanks!

> >

> > Jamie

> >

> >

>

>





Powered by ABC Amber Outlook Express Converter