trichview.support
Re: Iterating and retrieving table cells |
Author |
Message |
Yernar |
Posted: 04/06/2003 5:37:27 unit main; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, RVStyle, RVScroll, RichView , CRVData // TCustomRVData , RVTable // TRVTableItemInfo ; type TForm1 = class(TForm) rv: TRichView; rvs: TRVStyle; Button1: TButton; procedure Button1Click(Sender: TObject); private public end; var Form1: TForm1; implementation {$R *.DFM} procedure OperationWithSQLTable(Stream: TStream); begin {... enter your code here ...} end; procedure ExtractRTFCells(RVData: TCustomRVData); var i, r, c: Integer; Table: TRVTableItemInfo; RTFStream: TMemoryStream; begin RTFStream := TMemoryStream.Create; try for i := 0 to RVData.Items.Count - 1 do if RVData.GetItemStyle(i) = rvsTable then begin Table := TRVTableItemInfo(RVData.GetItem(i)); for r := 0 to Table.Rows.Count - 1 do for c := 0 to Table.Rows[r].Count - 1 do if Table.Cells[r, c] <> nil then begin RTFStream.Clear; Table.Cells[r, c].SaveRTFToStream(RTFStream, False, ...); OperationWithSQLTable(RTFStream); end; end; finally RTFStream.Free; end; end; procedure TForm1.Button1Click(Sender: TObject); begin ExtractRTFCells(rv.RVData); end; end. |
Powered by ABC Amber Outlook Express Converter