Recently, when using the thtmllabel control, we found that if the text contains Chinese characters, the control cannot provide good line breaks. This control does not have the wordwrap attribute either. ViewSource codeThe following situations are found:
1, wordwrap = Not ellipsis;
Although this control does not have the wordwrap attribute, the setting value of the ellipsis attribute affects the wordwrap behavior.
If ellipsis is true, the excess part is displayed as... but the line feed is not displayed.
If ellipsis is false, a line break is displayed in excess of the limit. The problem is that a line break is allowed in English and a line break is unavailable in Chinese.
2. spacepos: = pos ('', S );
Continue tracking and find that there is a above near line htmllengo. Pas 600CodeThat is to say, the automatic line feed is dependent on spaces, and in English habits, words cannot be wrapped. There are few spaces in Chinese statements, so line feed fails.
Modification Method (near htmllengo. Pas line 600 ):
// The original code looks down. // If wordwrap then begin // spacepos: = pos (',', S) // end else // spacepos: = 0; // Replace the following code with if wordwrap then begin if S = ''then spacepos: = 0 else begin if ord (s [1]) <127 then spacepos: = pos ('', S) else spacepos: = 1; end else spacepos: = 0;
Note: The Source Code may vary depending on the version number of the control. My version is: TMS pack. v5.2.4.1