I am new to RichViewEdit.
I came upon a problem when inputing chinese characters into tables. It is Ok when I type in characters in richViewEdit, but characters are displayed as squares when typed in table cells. AddNLATag works ok.
All unicode properties for styles are set to true, defUnicodeStyle =1, RTFReadProperties.UnicodeMode := rvruOnlyUnicode
Should I change any other setting?Or something I am wrong?
Thank you in advance.
How to input unicode in table cell
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
I just created a test project - placed RichViewEdit, RVStyle and Button on the form, and added the following code:
Since I can type both Russian and Greek in table cells, they contain Unicode text, as expected:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
RichViewEdit1.RTFReadProperties.UnicodeMode := rvruOnlyUnicode;
RichViewEdit1.Clear;
for i := 0 to RVStyle1.TextStyles.Count-1 do
RVStyle1.TextStyles[i].Unicode := True;
RichViewEdit1.Format;
end;
procedure TForm1.Button1Click(Sender: TObject);
var table: TRVTableItemInfo;
begin
table := TRVTableItemInfo.CreateEx(2,2,RichViewEdit1.RVData);
table.BorderWidth := 2;
table.CellBorderWidth := 1;
RichViewEdit1.InsertItem('', table);
end;
-
- Posts: 3
- Joined: Wed Jun 25, 2008 9:38 am
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 3
- Joined: Wed Jun 25, 2008 9:38 am
The test project is made just as the instructions in your posts, not any unusual. I saved the content of the component. It is like what follows:
{\rtf1\ansi\ansicpg0\uc1\deff0\deflang0\deflangfe0{\fonttbl{\f0\fnil Arial;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red255\green255\blue255;\red255\green255\blue255;\red128\green128\blue128;\red212\green208\blue200;}
\uc1
\pard\fi0\li0\ql\ri0\sb0\sa0\itap0 \plain \f0\fs20 \uc2\u24037 \'b9\'a4\uc1
\par {\trowd\trgaph45\trleft0\itap1\trpaddl15\trpaddt15\trpaddr15\trpaddb15\trpaddfl3\trpaddft3\trpaddfr3\trpaddfb3\trspdl15\trspdr15\trspdfl3\trspdfr3\trspdt15\trspdft3\trspdb15\trspdfb3\trftsWidth1\richviewtbw0\trbrdrl\brdroutset\brdrw30\trbrdrt\brdroutset\brdrw30\trbrdrr\brdroutset\brdrw30\trbrdrb\brdroutset\brdrw30\clftsWidth1\richviewcbw0\richviewcbh0\clbrdrl\brdrinset\brdrw15\clbrdrt\brdrinset\brdrw15\clbrdrr\brdrinset\brdrw15\clbrdrb\brdrinset\brdrw15\clcbpat17\cellx3180\clftsWidth1\richviewcbw0\richviewcbh0\clbrdrl\brdrinset\brdrw15\clbrdrt\brdrinset\brdrw15\clbrdrr\brdrinset\brdrw15\clbrdrb\brdrinset\brdrw15\clcbpat17\cellx6075\pard\intbl\itap1{{
\pard\fi0\li0\ql\ri0\sb0\sa0\itap1\intbl \plain \f0\fs20 \u0 \'00\u0 \'001\u0 \'00\u0 \'00\cell}{
\pard\fi0\li0\ql\ri0\sb0\sa0\itap1\intbl \plain \f0\fs20 \cell}}\pard\intbl\itap1\row}{\trowd\trgaph45\trleft0\itap1\trpaddl15\trpaddt15\trpaddr15\trpaddb15\trpaddfl3\trpaddft3\trpaddfr3\trpaddfb3\trspdl15\trspdr15\trspdfl3\trspdfr3\trspdt15\trspdft3\trspdb15\trspdfb3\trftsWidth1\lastrow\richviewtbw0\trbrdrl\brdroutset\brdrw30\trbrdrt\brdroutset\brdrw30\trbrdrr\brdroutset\brdrw30\trbrdrb\brdroutset\brdrw30\clftsWidth1\richviewcbw0\richviewcbh0\clbrdrl\brdrinset\brdrw15\clbrdrt\brdrinset\brdrw15\clbrdrr\brdrinset\brdrw15\clbrdrb\brdrinset\brdrw15\clcbpat17\cellx3180\clftsWidth1\richviewcbw0\richviewcbh0\clbrdrl\brdrinset\brdrw15\clbrdrt\brdrinset\brdrw15\clbrdrr\brdrinset\brdrw15\clbrdrb\brdrinset\brdrw15\clcbpat17\cellx6075\pard\intbl\itap1{{
\pard\fi0\li0\ql\ri0\sb0\sa0\itap1\intbl \plain \f0\fs20 \cell}{
\pard\fi0\li0\ql\ri0\sb0\sa0\itap1\intbl \plain \f0\fs20 \cell}}\pard\intbl\itap1\row}
\plain \f0\fs20 \uc2\u24037 \'b9\'a4\uc1 2\par}
Inside which, \'b9\'a4 should be correct items outside the table, just as what I typed in and showed up correctly. Inside the table the code related became '\00\'u0
{\rtf1\ansi\ansicpg0\uc1\deff0\deflang0\deflangfe0{\fonttbl{\f0\fnil Arial;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red255\green255\blue255;\red255\green255\blue255;\red128\green128\blue128;\red212\green208\blue200;}
\uc1
\pard\fi0\li0\ql\ri0\sb0\sa0\itap0 \plain \f0\fs20 \uc2\u24037 \'b9\'a4\uc1
\par {\trowd\trgaph45\trleft0\itap1\trpaddl15\trpaddt15\trpaddr15\trpaddb15\trpaddfl3\trpaddft3\trpaddfr3\trpaddfb3\trspdl15\trspdr15\trspdfl3\trspdfr3\trspdt15\trspdft3\trspdb15\trspdfb3\trftsWidth1\richviewtbw0\trbrdrl\brdroutset\brdrw30\trbrdrt\brdroutset\brdrw30\trbrdrr\brdroutset\brdrw30\trbrdrb\brdroutset\brdrw30\clftsWidth1\richviewcbw0\richviewcbh0\clbrdrl\brdrinset\brdrw15\clbrdrt\brdrinset\brdrw15\clbrdrr\brdrinset\brdrw15\clbrdrb\brdrinset\brdrw15\clcbpat17\cellx3180\clftsWidth1\richviewcbw0\richviewcbh0\clbrdrl\brdrinset\brdrw15\clbrdrt\brdrinset\brdrw15\clbrdrr\brdrinset\brdrw15\clbrdrb\brdrinset\brdrw15\clcbpat17\cellx6075\pard\intbl\itap1{{
\pard\fi0\li0\ql\ri0\sb0\sa0\itap1\intbl \plain \f0\fs20 \u0 \'00\u0 \'001\u0 \'00\u0 \'00\cell}{
\pard\fi0\li0\ql\ri0\sb0\sa0\itap1\intbl \plain \f0\fs20 \cell}}\pard\intbl\itap1\row}{\trowd\trgaph45\trleft0\itap1\trpaddl15\trpaddt15\trpaddr15\trpaddb15\trpaddfl3\trpaddft3\trpaddfr3\trpaddfb3\trspdl15\trspdr15\trspdfl3\trspdfr3\trspdt15\trspdft3\trspdb15\trspdfb3\trftsWidth1\lastrow\richviewtbw0\trbrdrl\brdroutset\brdrw30\trbrdrt\brdroutset\brdrw30\trbrdrr\brdroutset\brdrw30\trbrdrb\brdroutset\brdrw30\clftsWidth1\richviewcbw0\richviewcbh0\clbrdrl\brdrinset\brdrw15\clbrdrt\brdrinset\brdrw15\clbrdrr\brdrinset\brdrw15\clbrdrb\brdrinset\brdrw15\clcbpat17\cellx3180\clftsWidth1\richviewcbw0\richviewcbh0\clbrdrl\brdrinset\brdrw15\clbrdrt\brdrinset\brdrw15\clbrdrr\brdrinset\brdrw15\clbrdrb\brdrinset\brdrw15\clcbpat17\cellx6075\pard\intbl\itap1{{
\pard\fi0\li0\ql\ri0\sb0\sa0\itap1\intbl \plain \f0\fs20 \cell}{
\pard\fi0\li0\ql\ri0\sb0\sa0\itap1\intbl \plain \f0\fs20 \cell}}\pard\intbl\itap1\row}
\plain \f0\fs20 \uc2\u24037 \'b9\'a4\uc1 2\par}
Inside which, \'b9\'a4 should be correct items outside the table, just as what I typed in and showed up correctly. Inside the table the code related became '\00\'u0
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: