In fastreport, Memo's wordwrap is set to true, so that the text is automatically wrapped. However, when the last word is Chinese, garbled characters are always displayed. How can I enable automatic line feed when the last word is Chinese and there are less than two cells in the remaining shard area to avoid garbled characters?
This mainly changes the wrapline process in fr_class.pas. One of them is as follows:
Else if s [last] = then
Outline (copy (S, beg, last-Beg) else
Outline (copy (S, beg, last-Beg + 1); // the root cause of garbled characters
Change
Else if s [last] = then
Outline (copy (S, beg, last-Beg) else
If bytetype (S, last) = mbleadbyte then // determine whether the byte is a Chinese character
Outline (copy (S, beg, last-Beg ))
Else
Outline (copy (S, beg, last-Beg + 1 ));
The
Looppos: = cur;
Beg: = last + 1; last: = beg;
To change:
Looppos: = cur;
If bytetype (S, last) = mbleadbyte then
Begin
Beg: = last; last: = beg;
End
Else
Begin
Beg: = last + 1; last: = beg;
End;
Refer to fastreport2.41c of the http://tian.yeah.net