Adjusting cell width

Top  Previous  Next

Looking at the previous illustration it is obvious that FastReport automatically adjusts cell widths so that larger cell values do actually fit within the cells. This may not be desirable in some cases, however, as extra wide columns can appear ugly. What can be done about this? Let's look at three methods of controlling cell width.

 

The simplest method of controlling cell width is to add line breaks to the text of intermediate totals, i.e.:

 

Total

for[Value]

 

The resulting table is more compact:

 

_img196

 

However, there are circumstances where it is difficult or impossible to sensibly break lines manually. The cross-tab object has therefore been given both “MinWidth” and “MaxWidth” properties (referring to cell widths). Both of these properties are only accessible via the object inspector.

 

By default “MinWidth” is 0 and “MaxWidth” is 200, which is adequate in most cases. The second method of controlling cell width is to alter these values according to special requirements.

 

So in our example we can set both “MinWidth” and “MaxWidth” to 50. This means that a data cell must be at least 50 pixels wide, even if the cell value would fit into fewer pixels. For large cell values the cell width is limited to the “MaxWidth” value and the text in the cell is broken as required. So our example now looks like this:

 

_img197

 

The third method of controlling cell width is to change cell widths manually. To be able to do this the AutoSize property must be set to False. The cross-tab cell width can then be changed using the mouse. In the report page cross-tab object, the mouse cursor changes shape over cell borders so allowing the borders to be dragged. Here is an example of what can be achieved:

 

clip0215

 

Remember that if auto-size is turned off then the cross-tab will not automatically adjust the cell widths and heights and you may see something like this in the report preview:

 

clip0216

 

If so then just increase the cell widths a little.