trichview.support
Re: how to change all richview text to unicode ? |
Author |
Message |
Sergey Tkachenko |
Posted: 02/04/2005 12:44:26 I am copying my answer about how to make Unicode text editor with TRichView: 1) Set Unicode property to True for all TextStyles in TRVStyle 2) Set RichViewEdit1.RTFReadProperties.UnicodeMode = rvruOnlyUnicode 3) Some methods cannot be used, if the document is in Unicode. - Add, AddFmt, AddNL, AddNLTag, AddTextBlockNL (use AddNLATag or AddNLWTag instead) - AddTextNL (use AddTextNLA or AddTextNLW instead); - SetItemText (use SetItemTextA or SetItemTextW instead) - SetItemTextEd (use SetItemTextEdA or SetItemTextEdW instead) - SetCurrentItemText (use SetCurrentItemTextA or SetCurrentItemTextW instead) 4) Existing non-Unicode RVF documents must be converted to Unicode by calling ConvertToUnicode after loading them (see below). It safe to call this procedure for Unicode documents - it will do nothing. 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; 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; > > hi > how to change all richview text to unicode ? |
Powered by ABC Amber Outlook Express Converter