Adjusting row/column size

Top  Previous  Next

The width and height of the table columns and rows can be adjusted by using the “OnCalcWidth” and “OnCalcHeight:” event handlers. Let's see how to increase the width of the column holding the 11th month of 1999 with the following example. Create an “OnCalcWidth” event handler:

 

Pascal script:

 

procedure Cross1OnCalcWidth(ColumnIndex: Integer;

 ColumnValues: Variant; var Width: Extended);

begin

if (VarToStr(ColumnValues[0]) = '1999') and

   (VarToStr(ColumnValues[1]) = '11') then

   Width := 100;

end;

 

C++ Script:

 

void Cross1OnCalcWidth(

int ColumnIndex,

variant ColumnValues,

Extended &Width)

{

if ((VarToStr(ColumnValues[0]) == "1999") &&

   (VarToStr(ColumnValues[1]) = "11"))

   {

     Width = 100;

   }

}

 

And the report becomes:

 

_img204

 

To hide a column in our example just set the Width to zero. Note that the totals are not recalculated as the table is already filled with values at this point.