HotXLS-dokumentation

AutoFit metod

Changes the width of the columns in the range or the height of the rows in the range to achieve the best fit

Syntax

procedure AutoFit(Columns: boolean);
Columns Boolean. True för att ändra kolumnernas bredd; False för att ändra radernas höjd

Exempel

Exemplet ändrar bredden på kolumnerna i det använda området för att uppnå bästa möjliga anpassning

Workbook.Sheets[1].UsedRange.AutoFit(True);
This example is the same to the previous

Workbook.Sheets[1].UsedRange.Columns.AutoFit;
Exemplet ändrar höjden på raderna i det använda området för att uppnå bästa möjliga anpassning

Workbook.Sheets[1].UsedRange.AutoFit(False);
This example is the same to the previous

Workbook.Sheets[1].UsedRange.Rows.AutoFit;