richview 添加表格
procedure TForm1.mitInserttable1Click(Sender: TObject);
var
table: TRVTableItemInfo;
r, c: Integer;
begin
table := TRVTableItemInfo.CreateEx(4, 3, RichViewEdit1.RVData);
table.BorderStyle := rvtbRaisedColor;
table.CellBorderStyle := rvtbLoweredColor;
table.BorderLightColor := $00FAF1C9;
table.BorderColor := $00A98E10;
table.CellBorderLightColor := $00FAF1C9;
table.CellBorderColor := $00A98E10;
table.Color := $00EAC724;
table.BorderWidth := 5;
table.CellBorderWidth := 2;
table.CellPadding := 5;
table.CellVSpacing := 1;
table.CellHSpacing := 1;
table.BorderVSpacing := 1;
table.BorderHSpacing := 1;
for r := 0 to table.Rows.Count - 1 do
for c := 0 to table.Rows[r].Count - 1 do
table.Cells[r, c].BestWidth := 100;
table.MergeCells(0, 0, 3, 1, False);
table.MergeCells(1, 0, 1, 3, False);
with table.Cells[0, 0] do
begin
Color := clInfoBk;
Clear;
AddBullet('', 0, il, 2);
AddNL(' Example 1 ', 1, -1);
AddBullet('', 0, il, -1);
AddNL('All cells have 100 pixels width, width of table itself is calculated basing on width of cells.',
0, 0);
end;
if RichViewEdit1.InsertItem('', table) then
begin
RichViewEdit1.Format;
end;
end;
var
table: TRVTableItemInfo;
r, c: Integer;
begin
table := TRVTableItemInfo.CreateEx(4, 3, RichViewEdit1.RVData);
table.BorderStyle := rvtbRaisedColor;
table.CellBorderStyle := rvtbLoweredColor;
table.BorderLightColor := $00FAF1C9;
table.BorderColor := $00A98E10;
table.CellBorderLightColor := $00FAF1C9;
table.CellBorderColor := $00A98E10;
table.Color := $00EAC724;
table.BorderWidth := 5;
table.CellBorderWidth := 2;
table.CellPadding := 5;
table.CellVSpacing := 1;
table.CellHSpacing := 1;
table.BorderVSpacing := 1;
table.BorderHSpacing := 1;
for r := 0 to table.Rows.Count - 1 do
for c := 0 to table.Rows[r].Count - 1 do
table.Cells[r, c].BestWidth := 100;
table.MergeCells(0, 0, 3, 1, False);
table.MergeCells(1, 0, 1, 3, False);
with table.Cells[0, 0] do
begin
Color := clInfoBk;
Clear;
AddBullet('', 0, il, 2);
AddNL(' Example 1 ', 1, -1);
AddBullet('', 0, il, -1);
AddNL('All cells have 100 pixels width, width of table itself is calculated basing on width of cells.',
0, 0);
end;
if RichViewEdit1.InsertItem('', table) then
begin
RichViewEdit1.Format;
end;
end;