---
title: "GridWorksheet.AutoFitColumn"
url: "https://reference.aspose.com/cells/net/aspose.cells.gridweb.data/gridworksheet/autofitcolumn/"
product: "Aspose.Cells for .NET API Reference"
description: "GridWorksheet method. Autofits the column width"
---

## AutoFitColumn(int, int, int) {#autofitcolumn_1}

Autofits the column width.

```csharp
public void AutoFitColumn(int columnIndex, int firstRow, int lastRow)
```

| Parameter | Type | Description |
| --- | --- | --- |
| columnIndex | Int32 | Column index. |
| firstRow | Int32 | First row index. |
| lastRow | Int32 | Last row index. |

### Remarks

This method autofits a row based on content in a range of cells within the row.

### See Also

* class [GridWorksheet](../)
* namespace [Aspose.Cells.GridWeb.Data](../../../aspose.cells.gridweb.data/)
* assembly [Aspose.Cells.GridWeb](../../../)

---

## AutoFitColumn(int) {#autofitcolumn}

Autofits the column width.

```csharp
public void AutoFitColumn(int columnIndex)
```

| Parameter | Type | Description |
| --- | --- | --- |
| columnIndex | Int32 | Column index. |

### Remarks

AutoFitColumn is an imprecise function.

### See Also

* class [GridWorksheet](../)
* namespace [Aspose.Cells.GridWeb.Data](../../../aspose.cells.gridweb.data/)
* assembly [Aspose.Cells.GridWeb](../../../)


