I stored RVF file in database table.
Sometimes I need to the export file in RTF format. Is it possible to do without a form with the the RichView control?
Export (save) to RTF without coontrol
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
You can use TRVReportHelper component. It contains an invisible TRichView itself, but it does not require a form.
If document contains tables, RVReportHelper must be formatted before saving RTF. So you need some canvas for formatting.
If document contains tables, RVReportHelper must be formatted before saving RTF. So you need some canvas for formatting.
Code: Select all
var
helper: TRVReportHelper;
Canvas: TCanvas;
DC: HDC;
begin
helper := TRVReportHelper.Create(nil);
helper.RichView.Style := TRVStyle.Create(helper);
helper.RichView.Options := helper.RichView.Options+[rvoTagsArePChars];
helper.RichView.RVFOptions := helper.RichView.RVFOptions+[rvfoLoadDocProperties];
helper.RichView.RTFOptions := helper.RichView.RTFOptions+[rvrtfSaveDocParameters];
helper.RichView.LoadRVFFromStream(...);
Canvas := TCanvas.Create;
DC := GetDC(0);
Canvas.Handle := DC;
helper.Init(Canvas, 600);
helper.RichView.SaveRTF(...);
Canvas.Handle := 0;
Canvas.Free;
ReleaseDC(0, DC);
helper.Free;
end;