trichview.support
Re: RvHTMLImporter |
Author |
Message |
Jonas Bilinkevicius |
Posted: 04/01/2004 15:48:39 "Sergey Tkachenko" <[email protected]> wrote in message news:[email protected]... > RichViewActions use RTF unicode settings for importing HTML. > If you set RichViewEdit.RTFReadProperties.UnicodeMode = rvruOnlyUnicode, Yes, UnicodeMode is set to rvruOnlyUnicode > they automatically convert the imported text to Unicode. > The point is: if UnicodeMode = rvruOnlyUnicode, it's assumed that you want > to have only Unicode text in editor. > RichViewActions use temporal invisible TRichView when importing HTML. They > load HTML into it, then convert it to Unicode (if necessary). After that > they insert the result in the target editor. If I am copy for example RU text from HTML page and then paste it using Paste Speacial - > HTML the text appears like ????? ???? ??? I thought that your suggestion below could help me: To: "CC" <[email protected]> From: "Sergey Tkachenko" <[email protected]> Subject: Re: Problem with Loadhtml Date: Sat, 1 Nov 2003 13:45:54 +0300 Groups: trichview.support.thirdparty 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