trichview.com

trichview.support




Re: List of paragraphs.


Return to index


Author

Message

Sergey Tkachenko

Posted: 10/18/2003 15:22:26


1.


The simplest procedure is:


var i: Integer;


for i := 0 to rv.ItemCount-1 do

  if rv.IsParaStart(i) then begin

    { this item starts a paragraph,

    rv.GetItemPara(i) is a paragraph

    style - index in the collection

    rv.Style.ParaStyles }

  end;


But table cells are subdocuments with their own paragraphs.

To enumerate all paragraphs including table cells, you need a recursive

procedure


uses CRVData, RVTable;


procedure EnumParas(RVData: TCustomRVData);

var i, r,c: Integer;

   table: TRVTableItemInfo;

begin

  for i := 0 to RVData.ItemCount-1 do

  begin

    if RVData.IsParaStart(i) then

    begin

      // RVData.GetItemStyle(i), etc.

    end;

    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

            EnumParas(table.Cells[r,c].GetRVData);

    end;

end;


2.

The only event that you can use for this task - OnItemAction (not sure if it

helps)


>

> How does paragraphs work in rich edit

> I want to

>       1. traverse through paragraphs in the document.

>       2. Get on delete paragraph and on add paragraph event.

>





Powered by ABC Amber Outlook Express Converter