Page 1 of 1

Centering Row (0) and Column (0)

Posted: Wed Feb 20, 2008 10:32 am
by Raymond Allan
Hi,

Have just recently upgraded to version 3.x, from ver 2.x

I am trying to center column (0) where the row numbers will appear

the following worked fine on ver 2.x

procedure TFmEd.GridGetCellFormat(Sender: TObject; Col, Row: Integer;
State: TGridDrawState; var FormatOptions: TFormatOptions);
begin
if (Row = 0) or (Col = 0) then
FormatOptions.AlignmentHorz := taCenter;
end;

Only Row (0) is being centered

has the method changed in 3.x

Also, does anyone know a quick way to autosize all columns based on the cell in each column that has the largest text/number, like in Excel where you double click the required columns to autofit

Thanks for looking

Raymond

Posted: Fri Feb 22, 2008 9:37 am
by larsa
Hello

1. The GridGetCellFormat is not a part of XLSReadWrietII. It seems to come from a grid component.

2. In order to autosize a column, use the AutoWidthCol method of the sheet.


Lars Arvidsson