Report ColumnWidths Calculated wrong, here is possible solution for this bug.
Original Reporter info from Mantis: SunyD @soner-a
-
Reporter name: Soner
Original Reporter info from Mantis: SunyD @soner-a
- Reporter name: Soner
Description:
If your report has more than two column the last column does not fit in the page, because the column widths are calculated wrong. Here is possible the solution. Change in 2 files ony one row (copy the next lines in lazarus):
//1. In File: LR_Desgn.pas, in the middle:
procedure TfrDesignerPage.Draw(N: Integer; AClipRgn: HRGN);
//...
with FDesigner.Page do
//...
//change here ...
//soner original was this: ColWidth := (RightMargin - LeftMargin) div ColCount;
ColWidth := ((RightMargin - LeftMargin) div ColCount ) - (ColGap*(ColCount-1)); //soner: ColWidth:= (PrintAreaWidth div Colcount) - ColGaps
// ... until here 1 line
Pen.Style := psDot;
//2. In File: LR_Class.pas, at the end
procedure TfrPage.TossObjects;
//..
if ColCount = 0 then ColCount := 1;
// change below:
//soner original was this: ColWidth := (RightMargin - LeftMargin) div ColCount;
ColWidth := (RightMargin - LeftMargin - (ColGap*(ColCount-1))) div ColCount ; //soner: ColWidth:= (PrintAreaWidth-ColGaps) div Colcount
end;
Steps to reproduce:
- Open Report-designer
- Change in Menug [Page Options]
Tabsheet [Options]
Following properties:
Page-Margins.left:10
Page-Margins.right:10
Columns more than 2,
Column Gap: 5
-
CLick ok
-
Now when you can measure column widths with a memo then you will see that the last column is over the right margin.
or click preview
Additional information:
I put possible solution in Description.
Mantis conversion info:
- Mantis ID: 32152
- OS: Windows
- OS Build: xp, 7, 10
- Build: Svn-REv.54278
- Platform: i386
- Version: 1.6.4
- Fixed in version: 1.7 (SVN)
- Target version: 1.8