WPCubed Product Support

Empty paragraphs from HTML, formatting

Consider the following scenario:

procedure TForm1.Button1Click(Sender: TObject);begin with TWpRichText.Create(Self) do begin   Parent := Self;   Align := AlClient;   AsString := '<div>begin 3 enters</div><div></div><div></div><div></div><div>end 3 enter</div>';   AsWebPage := [wpFormatAsWebPage]; end;end;

This will not display the 3 empty paragraphs on the TWpRichText.
It will just output as

begin 3 enters
end 3 enters

Now if i remove the AsWebPage := [wpFormatAsWebPage]; i will get an entirely different but still undesired result, but now it will display 6 empty lines.

begin 3 enters

end 3 enters

I've tested this with wptools 6.13.1 and with wptools 6.25, both gave the same results.

I have managed to fix the formatting with wpFormatAsWebPage by changing the following code inside function TParagraph.Reformat

if cc = #10 then
      begin
        ....
        lastx := 0;
        {$IFDEF OBEC}
        iHeight := _DefaultHeight;
        {$ELSE}
        iHeight := 0;
        {$ENDIF}
        inc(i);
        if i = CharCount then break;

The issue without wpFormatAsWebPage is not important to me, so i leave that one up to you to fix.

PS.
I can not be sure my solution is correct until it has had extensive testing. In any case setting the height to 0 does not seem very useful to me. Defaultheight might not be sufficient either though, but it looks to be an improvement anyway.[/code][/quote]

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

Just noticed when using the up and down arrow keys to loop through the paragraphs it still requires 2 clicks to jump to the next / previous paragraph. So it looks like somehow the editor still thinks there are 2 paragraphs. Typing on those lines can be a bit buggy as well.

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