trichview.com

trichview.support




Re: When using LoadRTFFromStream, an extra newline is added at thebeginning


Return to index


Author

Message

Daniel Albuschat

Posted: 03/17/2004 10:16:26


Sergey Tkachenko wrote:

> Call RichViewEdit1.Clear before LoadRTFFromStream.

> Each RichViewEdit has one empty line initially, and LoadRTFFromStream

> appends RTF to the end of document.


Ah... the problem was something different. `Each RichViewEdit has one

empty line initially' made that clear;

My function looked like this:


       M_Text.Clear;

       M_Text.Format;

       ms := TMemoryStream.Create;

       sl.Text := s;

       sl.SaveToStream(ms);

       ms.Seek(0, soFromBeginning);

       M_Text.LoadRTFFromStream(ms);

       ms.Free;

       M_Text.FormatTail;


where M_Text is a TRichViewEdit, ms is a TMemoryStream and sl is a

TStringList.

Calling Format after the Clear has caused this `initial newline'.

I thought it was required, because if I did not call it, I got an error

message whenever entering/focusing the TRichViewEdit (Index out of

Bounds). But that was because I can't use FormatTail if the

TRichViewEdit wasn't formatted before.

So removing the Format after the clear and changing FormatTail to

Format solves the problem.


Thank you every much,

    Daniel





Powered by ABC Amber Outlook Express Converter