WPCubed Product Support

In TWPRichText, loading 2 x <br> tags hides text

I can reproduce this problem by having a string containing valid HTML, and with two of the offending tags in a row. Example:

vStr := '<html><head></head><body>Hi Michael' +
'<br><br>This line will not appear.' +
'</body></html>';

WPRT.Clear;
WPRT.AsWebpage := [wpFormatAsWebpage];
WPRT.LoadFromString(vStr, 'HTML')

I can (hopefully, temporarily) solve the problem by doing a global replace of '<br' with '&nbsp;<br'.

Am I doing something wrong ?

#1 ♥ 0
4.4k Views 2 users read 2 min

Traced it back to TParagraph.Reformat

The format routine skips the second <BR>, but the paint engine does not. Because the linecount is longer valid (set in format routine) the last line will not get painted.

This seems like a pretty huge flaw to me.

I have solved this in code by adding the following at the end of function TParagraph.Reformat. (look for $IFDEF OBEC)

CharPos[i].xoff := x - lastx;
      lastx := x;
      {$IFDEF OBEC}
      if cc = #10
      then dec(i);
      {$ENDIF}
      inc(x, CharPos[i].Width);
      if CharPos[i].Height > iHeight then iHeight := CharPos[i].Height;
      if CharPos[i].Base > iBase then iBase := CharPos[i].Base;
      inc(i);

Also note that i have only tested this with {$IFDEF NEWREFORMAT}.

#3 ♥ 0
This category is archived. No new posts are possible.