#1 2018-10-17 09:00:05

Ratay
Member
Registered: 2018-10-17
Posts: 1

Underlines in rich text

Hi,
when system default printer paper size is smaller than A4 (letter or A5 for example)
and richedit component contains underlined characters these underscores are not rendered at bottom of page
except underscores all page contents looks correct (including page footer)

thanks

code:

uses mORMotReport,synpdf;

procedure SaveToPdf(rtHandle:HWnd; SFile:string);
begin
  with TGDIPages.Create(self) do
  begin
    Caption := 'Report';
    NewPageLayout(TGdiPagePaperSize(psA4));
    BeginDoc;
    SaveLayout;
    AddTextToHeader('Header');
    AddPagesToFooterAt('%d / %d',RightMarginPos);
    RestoreSavedLayout;
    DrawTitle('begin',false);
    AppendRichEdit(rtHandle);
    EndDoc;
    ExportPDF(sFile,true,false);
  end;
end;

Offline

#2 2019-11-20 14:45:52

MtwStark
Member
From: Italy
Registered: 2016-01-05
Posts: 27

Re: Underlines in rich text

Hi Ratay,
I think I had a similar problem with underlined text in RichEdit,
I found that the underline was produced with a new EMR_BITBLT metafile record and maybe the coordinates for this emulated line falls out of the RichEdit

I had already changed my EMR_BITBLT for a similar reason

{$IFDEF TMW_TEST_NEW_GDI}
    E.FillRectangle(Rect(xDest - 1, yDest - 1, xDest + cxDest, yDest + cyDest), true);
{$ELSE}
    E.FillRectangle(Rect(xDest, yDest, xDest + cxDest, yDest + cyDest), true);
{$ENDIF}

If you have sources of your report engine, you can take a look also at the AutoSize procedure for RichEdit, maybe a simple +1 in CalcHeight will fix wink

Last edited by MtwStark (2019-11-20 14:53:48)

Offline

Board footer

Powered by FluxBB