trichview.com

trichview.support.thirdparty




Re: Problem with Loadhtml


Return to index


Author

Message

Fam

Posted: 09/08/2004 8:20:43


Hi, just to check if the next update is available now?


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

>Yes, RVHTMLImporter uses non-Unicode text styles.

>If your application must use completely Unicode documents, you need to

>convert results of RVHTMLImporter to Unicode.

>

>Next update of RichViewActions will do it automatically, if

>RichViewEdit.RTFReadProperties.UnicodeMode = rvruOnlyUnicode (i.e. HTML

>insertion will use the same Unicode rules, as RTF insertion/loading).

>

>If you use RVHTMLImporter directly, you need to convert the document to

>Unicode yourself.

>Below is how to do it:

>

><< ------------------

>

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

>

>-------------- >>

>

>> I type unicode characters, it's ok.

>> After loading with loadhtml function (RvHtmlImporter) , I can't type

>unicode

>> characters ( changed to ? character).

>> What should I do?

>>

>> Thanks for any help.

>>

>> C.C

>>

>>

>

>





Powered by ABC Amber Outlook Express Converter