Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.Cells provides a Workbook class that represents a Microsoft Excel file. The Workbook class contains a Worksheets collection that allows access to each worksheet in an Excel file. A worksheet is represented by the Worksheet class. The Worksheet class provides a wide range of properties and methods for managing a worksheet. This article looks at using the Worksheet class to auto‑fit rows or columns.
The most straightforward approach to auto‑sizing the height of a row is to call the Worksheet class AutoFitRow method. The AutoFitRow method takes a row index (the row to be resized) as a parameter.
A row is composed of many columns. Aspose.Cells allows developers to auto‑fit a row based on the content in a range of cells within the row by calling an overloaded version of the AutoFitRow method. It takes the following parameters:
The AutoFitRow method checks the contents of all the columns in the row and then auto‑fits the row.
A column is composed of many rows. It is possible to auto‑fit a column based on the content in a range of cells in the column by calling an overloaded version of the AutoFitColumn method that takes the following parameters:
The AutoFitColumn method checks the contents of all rows in the column and then auto‑fits the column.
With Aspose.Cells it is possible to auto‑fit rows even for cells that have been merged using the AutoFitterOptions API. The AutoFitterOptions class provides the AutoFitMergedCellsType property that can be used to auto‑fit rows for merged cells. AutoFitMergedCellsType accepts an AutoFitMergedCellsType enumeration which has the following members:
You may also use the overloaded versions of AutoFitRows and AutoFitColumns methods, which accept a range of rows/columns and an instance of AutoFitterOptions, to auto‑fit the selected rows/columns with your desired options.
The signatures of the aforesaid methods are as follows:
AutoFitRows(int startRow, int endRow, AutoFitterOptions options)AutoFitColumns(int firstColumn, int lastColumn, AutoFitterOptions options)Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.