trichview.com

trichview.support




Re: How can i del a whole chinese characters once??


Return to index


Author

Message

Sergey Tkachenko

Posted: 02/17/2003 19:59:58


Current version supports Chinese characters only if you use Unicode encoding

(you can still import and export files in traditional encoding, but internal

representation must be Unicode).


How to enable Unicode:

1) You need to set Unicode property of all text styles to True. If you have

some already created documents, see (3)

2) Set property Editor.RTFReadProperty.UnicodeMode to rvruOnlyUnicode (this

will affect importing RTF documents)

3) Below is a copy of my earlier posting how to convert existing RichView

documents to Unicode:


RichView documents can contain mixed contents - both Unicode and single-byte

text.

The code below converts all single-byte text in the document to Unicode:


uses RichView, RVTable, CRVData, RVUni;


// internal procedure

procedure ConvertRVToUnicode(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 then begin

      if not RVData.GetRVStyle.TextStyles[StyleNo].Unicode then begin

        RVData.SetItemText(i, RVU_GetRawUnicode(RVData.GetItemTextW(i)));

        Include(RVData.GetItem(i).ItemOptions, rvioUnicode);

      end;

      end

    else 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

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

    end;

  end;

end;


// main procedure

procedure ConvertToUnicode(rv: TCustomRichView);

var i: Integer;

begin

  ConvertRVToUnicode(rv.RVData);

  for i := 0 to rv.Style.TextStyles.Count-1 do

    rv.Style.TextStyles[i].Unicode := True;

end;


Call

RichViewEdit1.ClearUndo;

ConvertToUnicode(RichViewEdit1);


RVStyle object must be used exclusively by the given RichView (RichViewEdit1

in this example), otherwise documents in other RichViews linked to the same

RVStyle will be corrupted.


Text is converted basing on its Charset. If Charset = DEFAULT_CHARSET,

conversion is based on RVStyle.DefCodePage (main system language by default)



>

> in a edit area, if del key is pressed, I find a problem, a chinese

characters

> is divide up, How can i del a whole chinese characters once??





Powered by ABC Amber Outlook Express Converter