how to set list style in TRichView?

General TRichView support forum. Please post your questions here
Post Reply
eLan
Posts: 8
Joined: Fri Apr 07, 2006 7:32 am

how to set list style in TRichView?

Post by eLan »

Hi, I have a table in TRichView and wanna to apply list style for some cells.
Is SetListMarkerInfo the only way? How to get ItemNo in table cells?

Thanks in advance.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Should it be an editing operation (that can be undone by users?)

Each cell has its own range of items, numbered from 0 to Cell.GetRVData.ItemCount-1

To apply list to the whole cell:

Code: Select all

Cell.Edit;
Cell.SelectAll;
RichViewEdit1.ApplyListStyle(...);
eLan
Posts: 8
Joined: Fri Apr 07, 2006 7:32 am

Post by eLan »

Hi, the following code generates exception which raises from procedure call MultiLevelList in unit RVMarker. Do you have any ideas why these code doesn't work?

Code: Select all

var
  i: Integer;
  tbl: TRVTableItemInfo;
begin
  RichView.Clear;

  with RVStyle1.ListStyles.Add do
  begin
    with Levels.Add do
    begin
      FirstIndent := 0;
      LeftIndent := 24+i*48;
      MarkerIndent := i*48;
      Font.Size := 10 * 2; // eLan
      ListType := rvlstDecimal;
      FormatString := Format('%%%d:s.',[i]);
    end;
    with Levels.Add do
    begin
      ListType := rvlstDecimal;
      FormatString := '(%1:s)';
      LeftIndent := 1;
      MarkerIndent := 1;
      FirstIndent := 0;
      Font.Assign(RVStyle1.TextStyles[0]);
      StartFrom := 1;
    end;
  end;
  
  tbl := TRVTableItemInfo.CreateEx(6, 1, RichView.RVData);
  tbl.ParaNo := 0;
  for i := 0 to 5 do
  begin
    tbl.Cells[i, 0].Clear;                
    tbl.Cells[i, 0].SetListMarkerInfo(-1, rvStyle1.ListStyles.Count - 1, 0, 1, 0, True);
    tbl.Cells[i, 0].AddNLWTag('aaaaaaaaa', -1, -1, i);
  end;
  tbl.BorderWidth := 0;
  tbl.CellBorderWidth := 1;
  tbl.CellBorderColor := clBlue;
  tbl.CellBorderStyle := rvtbColor;

  RichView.AddItem('', tbl);

  RichView.Format;
end;
Post Reply