Page 2 of 2

Posted: Tue Feb 08, 2011 7:48 am
by Sergey Tkachenko
2) This procedure shows how to get all text with colored background:

Code: Select all

procedure EnumColoredText(RVData: TCustomRVData);
var i, r, c, StyleNo: Integer;
    table: TRVTableItemInfo;
begin
  for i := 0 to RVData.ItemCount-1 do begin
    StyleNo := RVData.GetItemStyle(i);
    if (StyleNo>=0) and
       (RVData.GetRVStyle.TextStyles[StyleNo].BackColor<>clNone) then begin
      // do something with RVData.GetItemText(i)
      end
    else if StyleNo=rvsTable then begin
      table := TRVTableItemInfo(RVData.GetItem(i));
      for r := 0 to table.RowCount-1 do
        for c := 0 to table.ColCount-1 do
          if table.Cells[r,c]<>nil then
             EnumColoredText(table.Cells[r,c].GetRVData);
    end;
  end;
end;
Call:

Code: Select all

EnumColoredText(RichViewEdit.RVData);

Posted: Tue Feb 08, 2011 7:50 am
by Sergey Tkachenko
As for SelectAll error, you need to call rve.Format after loading files.

As for problems with Unicode file names, I am afraid it is unavoidable, because converters work with OEM file names. The only solution is creating a temporal copy of this file and import it.

Posted: Tue Feb 08, 2011 8:05 am
by viperpix
Sergey Tkachenko wrote:1)
...
Unfortunately, there are no ways to exclude pictures or tables when inserting RVF (RichView Format), so you may exclude it as well (well, there is a way: pasting in a hidden TRichViewEdit, removing pictures and tables in it, saving this hidden RichViewEdit using SaveRVFToStream, then inserting in the main editor using InsertRVFFromStreamEd).
Additionally, pictures or tables can appear as a result of drag&drop. You can exclude formats from AcceptDragDropFormats property.
i've set the AcceptDragDropFormats just like this:
rve.AcceptDragDropFormats:=[rvddRTF, rvddText, rvddUnicodeText];

but it still drops everything that is dragged from i.e. ms word and does not filter anything!

Posted: Tue Feb 08, 2011 8:36 am
by viperpix
Sergey Tkachenko wrote:As for SelectAll error, you need to call rve.Format after loading files.
...
tnx, thats right, i just used rve.format in a wrong place.

Posted: Tue Feb 08, 2011 9:35 am
by viperpix
viperpix wrote: ...
i've set the AcceptDragDropFormats just like this:
rve.AcceptDragDropFormats:=[rvddRTF, rvddText, rvddUnicodeText];

but it still drops everything that is dragged from i.e. ms word and does not filter anything!
What can i do for this?