Highlight issue

General TRichView support forum. Please post your questions here
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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);
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
viperpix
Posts: 39
Joined: Sat Jan 15, 2011 9:38 am

Post 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!
viperpix
Posts: 39
Joined: Sat Jan 15, 2011 9:38 am

Post 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.
viperpix
Posts: 39
Joined: Sat Jan 15, 2011 9:38 am

Post 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?
Post Reply