Quickreport forum
Go to Quickreport website
Welcome Guest Search | Active Topics | Log In | Register

KeepOnOnePage problem with qrExprmemo and Autostretch
euk-software
#1 Posted : 19 April 2017 11:04:38(UTC)
Rank: Newbie

Groups: Registered
Joined: 03/04/2017(UTC)
Posts: 1

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Hi,
the KeepOnOnePage-property is ignored when you use TQRExprmemos.

Please fix

My (quick) solutions:

Code:

Unit Quickrpt;
...
procedure TQRCustomBand.ExpandedHeight( var NewHeight : extended );
var
  I : integer;
  BottomGap : extended;
  theight : extended;
  pixfactor : extended;
begin
      FExpandedheight := size.height;
      pixfactor := 0.37795; // seems to be correct whichever canvas is in effect !
      bottomgap := 0;
      for I := 0 to ControlCount - 1 do
      begin
          if (Controls[I] is TQRDBText) or (Controls[I] is TQRDBImage)
               or (Controls[I] is TQRMemo) or (Controls[I] is TQRCustomRichText)
               or (Controls[I] is TQRExprMemo) // <==== ADDED
                then
          begin
             if TQRPrintable(Controls[I]).Enabled then
             begin
                if Controls[I] is TQRExprMemo then  // <==== ADDED
                        TQRExprMemo(Controls[I]).GetExpandedHeight( theight )  // <==== ADDED
                else if Controls[I] is TQRMemo then
                        TQRMemo(Controls[I]).GetExpandedHeight( theight )
                else if Controls[I] is TQRCustomRichText then
                        TQRCustomRichText(Controls[I]).GetExpandedHeight( theight )
                else
                        TQRPrintable(Controls[I]).GetExpandedHeight( theight );
                theight := (theight + Controls[I].top)/ pixfactor;
                if theight > FExpandedheight then
                begin
                   FExpandedheight := theight;
                   bottomgap := (self.height - Controls[I].top - Controls[I].height + 1)/ pixfactor;
                end;
            end;
          end;
      end;
      if bottomgap < 0 then bottomgap := 0;
      newheight := bottomgap + FExpandedheight;
end;


Code:

unit QRCtrls;
...
TQRExprMemo = class(TQRCustomLabel)
  private
    Merger : TQRMerger;
    FRemoveBlankLines : boolean;
  protected
    function GetCaptionBased : boolean; override;
    procedure Prepare; override;
    procedure UnPrepare; override;
    procedure Print(OfsX, OfsY : integer); override;
    procedure Paint; override;
  public
    constructor Create(AOwner : TComponent); override;
    procedure GetExpandedHeight(var newheight : extended );override; // <==== ADDED
  published
...
// ADDED START (Copy from TQRMemo)
procedure TQRExprMemo.GetExpandedHeight(var newheight : extended );
var
     Nlines : integer;
     lineheight : extended;
     function aLineHeight(Line : string) : integer;
     begin
        if HasParent then
            result := Muldiv(Longint(ParentReport.TextHeight(Font, Line)),Zoom,100)
        else
          Result := Canvas.TextWidth(Line);
     end;
begin
      FormatLines;
      lineheight := aLineHeight( 'W' );
      Nlines := FFormattedLines.Count;
      newheight := nlines * (lineheight);
end;

// ADDED END
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.036 seconds.