Save and Lod from DB table and various other questions

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
TonyBlom
Posts: 14
Joined: Sun Dec 15, 2013 12:17 pm

Save and Lod from DB table and various other questions

Post by TonyBlom »

I have a few questions relating to SR actionTestRibbonTab

I really like the look and feel and it has 99% of the functionality I want. I have added to it the ability to insert controls based on the InsertControls Demo It works.

1. I have no experience at the Ribbon. How do add a band and items ? Is there an step by step explanation ?
2. I wish to save my Doc to a Database table.
i. My field for the RVF is nVarChar(MAX) Is this OK ?
ii. Save and Load from DB table. Can you provide sample code of saving it to the DB and loading it back from the DB please. I tried for some hours to do it with streams but could not get it to work. I tried many different ways from various group postings but none of them work.
3. Id like to add compression. Is there anyway built into RVF to do compression or packed binary storage ?
Thanks very much,

Tony
Sergey Tkachenko
Site Admin
Posts: 17521
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

1. I suggest to google "Delphi TRibbon tutorial"
2. No, Unicode-text field cannot store RVF. varbinary should be used.
Probably, your problems were because of incorrect field type.
The functions are below. But instead of them, you can simply use TDBSRichViewEdit.

Code: Select all

function SaveRVFToField(srv: TSRichViewEdit; tbl: TDataSet; const FieldName: String): Boolean;
var Stream: TStream;
begin
  Stream := tbl.CreateBlobStream(tbl.FieldByName(FieldName), bmWrite);
  try
    Result := srv.RichViewEdit.SaveRVFToStream(Stream, False);
  finally
    Stream.Free;
  end;
end;
 
function LoadRVFFromField(srv: TSRichViewEdit; tbl: TDataSet; const FieldName: String): Boolean;
var Stream: TStream;
begin
  Stream := tbl.CreateBlobStream(tbl.FieldByName(FieldName), bmRead);
  try
    Result := srv.RichViewEdit.LoadRVFFromStream(Stream);
  finally
    Stream.Free;
  end;
  srv.Format;
end;
3. TRichView itself does not provide methods for compression. You can use other compression tools. For example, you can pack using ZLib (included in Delphi), see the help file on TZCompressionStream and TZDecompressionStream.
TonyBlom
Posts: 14
Joined: Sun Dec 15, 2013 12:17 pm

Post by TonyBlom »

Thanks Sergey. Got it all figured out. I have reverted to using the Action test Demo instead until I have mastered Ribbons and your actions.

Do you have a version of the ActionRibbon Demo without Tabs ?
Sergey Tkachenko
Site Admin
Posts: 17521
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, no, there is only a tabbed version of TRibbon demo.
Post Reply