Page 1 of 1

how to set list style in TRichView?

Posted: Mon Jan 01, 2007 8:58 am
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.

Posted: Mon Jan 01, 2007 1:55 pm
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(...);

Posted: Mon Jan 01, 2007 1:59 pm
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;