DBCrossView Header Height
Hi
I am trying to create a crosstab report with word-wrapped headers - it should look like
https://drive.google.com/file/d/0B2frzc9m9x...iew?usp=sharing
but the rows overwrite the headers, as here:
https://drive.google.com/file/d/0B2frzc9m9x...iew?usp=sharing.
No matter what I try, I cant get the Rows to flow correctly after the Headers.
In this example, the Header height is set in code:
procedure DBCross1OnCalcWidth(ColumnIndex: Integer; ColumnValues: Variant; var Width: Extended);
begin
//Width := 60;
if ColumnIndex = 0 then
Width := 50;
if ColumnIndex = 5 then
Width := 70;
if ColumnIndex >= 6 then
Width := 70;
end;
procedure DBCross1OnCalcHeight(RowIndex: Integer; RowValues: Variant; var Height: Extended);
begin
end;
procedure DBCross1Cell0OnBeforePrint(Sender: TfrxComponent);
begin
end;
procedure DBCross1OnBeforePrint(Sender: TfrxComponent);
begin
end;
procedure DBCross1OnPrintColumnHeader(Memo: TfrxMemoView; HeaderIndexes, HeaderValues, Value: Variant);
begin
Memo.Height := 70;
end;
procedure DBCross1Column0OnBeforePrint(Sender: TfrxComponent);
begin
end;
Any help, please...
Jon
I am trying to create a crosstab report with word-wrapped headers - it should look like
https://drive.google.com/file/d/0B2frzc9m9x...iew?usp=sharing
but the rows overwrite the headers, as here:
https://drive.google.com/file/d/0B2frzc9m9x...iew?usp=sharing.
No matter what I try, I cant get the Rows to flow correctly after the Headers.
In this example, the Header height is set in code:
procedure DBCross1OnCalcWidth(ColumnIndex: Integer; ColumnValues: Variant; var Width: Extended);
begin
//Width := 60;
if ColumnIndex = 0 then
Width := 50;
if ColumnIndex = 5 then
Width := 70;
if ColumnIndex >= 6 then
Width := 70;
end;
procedure DBCross1OnCalcHeight(RowIndex: Integer; RowValues: Variant; var Height: Extended);
begin
end;
procedure DBCross1Cell0OnBeforePrint(Sender: TfrxComponent);
begin
end;
procedure DBCross1OnBeforePrint(Sender: TfrxComponent);
begin
end;
procedure DBCross1OnPrintColumnHeader(Memo: TfrxMemoView; HeaderIndexes, HeaderValues, Value: Variant);
begin
Memo.Height := 70;
end;
procedure DBCross1Column0OnBeforePrint(Sender: TfrxComponent);
begin
end;
Any help, please...
Jon
Comments
Fixed with a kludge in
procedure TfrxCrossColumnHeader.CalcBounds;
begin
DoAdjust(Self);
SetLength(LevelHeights, FLevelsCount + 1);
Items := AllItems;
// calculate height of each row
for i := 0 to Items.Count - 1 do
begin
Item := Items;
l := Item.Level;
// cell headers always adjust the last level height
if Item.FIsCellHeader then
l := FLevelsCount
// don't count total elemens unless they are on last level.
// such elements will be adjusted later
else if Item.IsTotal then
if l <> FLevelsCount - 1 then continue;
if Item.Memo.Height > Item.FSize.Y then
Item.FSize.Y := Item.Memo.Height + (Item.Memo.GapY * 2) + (TFrxFrame(Item.Memo.Frame).ShadowWidth * 2) +
(TFrxFrame(Item.Memo.Frame).Width * 2);
if l >= 0 then
if Item.FSize.Y > LevelHeights[l] then
LevelHeights[l] := Item.FSize.Y;
end;
which works for me in this instance.
Could someone from FR please provide a better fix?
Thanks
Jon
These new properties should apply not only to cells but to column headers as well.
This would help to solve my problem too as I descripted in [topic="13107"]How to set Column Header height[/topic]