How to Save and Load TRiceView as TStream?
Posted: Sun May 30, 2010 10:27 pm
I have tried to create a project that having purpose to save and
load TRichView as TStream.
Code for saving TRichView:
code for load:
I want to provide the information when I run my application.
1. I have compiled my project successfully.
2. I also have saved the TRichView to database successfully.
3. When I tried to load the stream from database, I didn't get the error
message, but I didn't see anything in my TRichView.
From code above, Are there any something missing?
Any help or direction is greatly appreciated!
Regards,
Eko Indriyawan
load TRichView as TStream.
Code for saving TRichView:
Code: Select all
var
LocalStream: TStream;
begin
LocalStream := TMemoryStream.Create;
with SP_217SAVE do
begin
RichViewEdit1.SaveRTFToStream(LocalStream, False);
Tag := 0;
Tag := Tag + 1;
Parameters[Tag].Value := 'TEST';
Tag := Tag + 1;
Parameters[Tag].Value := 'TEST';
Tag := Tag + 1;
Parameters[Tag].LoadFromStream(LocalStream, ftBlob);
ExecProc;
end;
LocalStream.Free;
end;
Code: Select all
var
LocalStream: TStream;
begin
with SP_217DATA do
begin
Tag := 0;
Tag := Tag + 1;
Parameters[Tag].Value := 'TEST';
Close;
Open;
LocalStream := SP_217DATA.CreateBlobStream(SP_217DATACOMPONENT_DATA, bmRead);
LocalStream.Position := 0;
RichViewEdit1.Clear;
RichViewEdit1.LoadRTFFromStream(LocalStream);
end;
end;
1. I have compiled my project successfully.
2. I also have saved the TRichView to database successfully.
3. When I tried to load the stream from database, I didn't get the error
message, but I didn't see anything in my TRichView.
From code above, Are there any something missing?
Any help or direction is greatly appreciated!
Regards,
Eko Indriyawan