trichview.com

trichview.support




Re: Convert text to plain in C++


Return to index


Author

Message

Pieter E.

Posted: 10/30/2004 13:42:53


Do you have a C++ source for this feature?

(I've tried to read it and make my own C++ source, but it doesn't work...)


Thanks.


Pieter E.

"Sergey Tkachenko" <[email protected]> wrote:

>This code removes all text and paragraph formatting very fast.

>But it cannot be undone.

>And it does not change formatting for Unicode text (if RVStyle.TextStyles[0]

>is not Unicode)

>(if you remove a check for Unicode property, this procedure can damage the

>document)

>

>procedure RemoveFormatting(RVData: TCustomRVData);

>var i, r, c, StyleNo: Integer;

>    table: TRVTableItemInfo;

>begin

>  for i := RVData.ItemCount-1 downto 0 do begin

>    RVData.GetItem(i).ParaNo := 0;

>    StyleNo := RVData.GetItemStyle(i);

>    if StyleNo=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

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

>      end

>    else if StyleNo=rvsListMarker then

>      RVData.RemoveListMarker(i)

>    else if (StyleNo>=0) and

>      (RVData.GetRVStyle.TextStyles[0].Unicode=

>       RVData.GetRVStyle.TextStyles[StyleNo].Unicode) then begin

>      RVData.GetItem(i).StyleNo := 0;

>      RVData.SetItemTag(i, 0);

>    end;

>  end;

>end;

>

>Call it:

>  RemoveFormatting(RichViewEdit1.RVData);

>  RichViewEdit1.ClearUndo;

>  RichViewEdit1.Format;

>

>

>





Powered by ABC Amber Outlook Express Converter