i'd like to print a grid (detail subreport) with different # of columns for each master. (maybe by setting visible to hide/show components). but spread the columns printing to BestFit. (spread proportionaly)?
There is nothing built-in to ReportBuilder to do this. You will need set the certain DBText components Visible property to False in the cases you do not want to see that column, then based on the width of the page and your text, calculate the best fit width for each column at that given time.
---------------------------------------------------------- TECH TIP: Calculating the widths of components at run-time ----------------------------------------------------------
The example below shows how to calculate the widths of report components and position them horizontally.
This example procedure accepts a list of CustomText descendents and positions them flush left, one after the other. The Left position of the first component is used as the starting point.
Comments
There is nothing built-in to ReportBuilder to do this. You will need set
the certain DBText components Visible property to False in the cases you do
not want to see that column, then based on the width of the page and your
text, calculate the best fit width for each column at that given time.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
TECH TIP: Calculating the widths of components at run-time
----------------------------------------------------------
The example below shows how to calculate the widths of
report components and position them horizontally.
This example procedure accepts a list of CustomText
descendents and positions them flush left, one after
the other. The Left position of the first component is
used as the starting point.
procedure ppAlignHorizontal(aComponentList: TList);
var
lCustomText: TppCustomText;
lBitmap: TBitmap;
liPosition := 0;
begin
if (aComponentList = nil) then Exit;
if (aComponentList.Count = 0) then Exit;
lBitmap := TBitmap.Create;
liPosition := TppCustomText(aComponentList[0]).spLeft;
for liIndex := 0 to aComponentList.Count - 1 do
begin
lCustomText := TppCustomText(aComponentList[liIndex]);
{set components screen pixel left}
lCustomText.spLeft := liPosition;
{calc next position}
lBitmap.Canvas.Font := lCustomText.Font;
liTextWidth := lBitmap.Canvas.TextWidth(lComponent.Caption);
liPosition := liPosition + liTextWidth;
end;
lBitmap.Free;
end;
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com