1) About headers and footers.
If you will use ScaleRichView, you can define headers and footers in a single editor, TSRichViewEdit. This is the simplest solution.
If you use TRichViewEdit, you need a separate editor for each header and footer. In the simplest case: one TRichViewEdit for the main document, one TRichViewEdit for header, one TRichViewEdit for footer. However, documents may have special headers for the first page and for even pages, so you need up to 7 TRichViewEdit controls. You can find an example in Demos\DelphiUnicode\Assorted\Printing\Headers
2) This procedure creates a table from a string grid:
Code: Select all
function ConvertStringGridToTable(Grid: TStringGrid; Edit: TCustomRichViewEdit;
StyleNo, ParaNo: Integer): TRVTableItemInfo;
var r,c: Integer;
begin
Result := TRVTableItemInfo.CreateEx(Grid.RowCount, Grid.ColCount, Edit.RVData);
for r := 0 to Grid.RowCount-1 do
for c := 0 to Grid.ColCount-1 do begin
Result.Cells[r,c].Clear;
Result.Cells[r,c].AddTextNL(Grid.Cells[c,r], StyleNo, ParaNo, ParaNo);
end;
end;
Adding to the end of TRichViewEdit:
Code: Select all
var Table: TRVTableItemInfo;
begin
Table := ConvertStringGridToTable(StringGrid1, RichViewEdit1, 0, 0);
// define table properties, including column widths, here
RichViewEdit1.AddItem('', Table);
RichViewEdit1.Format;
end;
Adding to the end of TSRichViewEdit:
Code: Select all
var Table: TRVTableItemInfo;
begin
Table := ConvertStringGridToTable(StringGrid1, SRichViewEdit1.RichViewEdit, 0, 0);
// define table properties, including column widths, here
SRichViewEdit1.RichViewEdit.AddItem('', Table);
SRichViewEdit1.Format;
end;
3) For RTF, both loading and saving is supported. For DocX, only saving (it's possible to load DocX using converters and TRVOfficeConverter component, but converters may lose some formatting)