trichview.com

trichview.support




Re: unicode support problem of  the version1.7


Return to index


Author

Message

Sergey Tkachenko

Posted: 01/03/2003 19:04:41


When you load readme.rvf, styles in RVStyle1 are replaced with styles from

readme.rvf (which are not Unicode).


Below is a copy of posting to trichview.support.examples, how to convert

loaded document 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)




> it is the newest demo project actiontest.

>

> > All should work (even better than before).

> > Can you describe the problem more detaily? Or send me a source code of

> > project reproducing it.

> >

> > > I have set the property about unicode in the version1.7 like in the

> > version

> > > 1.6, but it can't work. why?

> > > thanks all your help!

> > >

> > >

> >

> >

>

>

>





Powered by ABC Amber Outlook Express Converter