AutoFit Row Height Automatically When Loading File

Possible Usage Scenarios

The row height automatically matches the font of the content, but when the height of the cached row does not match the height of the content in the file, MS Excel will automatically adjust the row height when loading the file, whereas Aspose.Cells does not adjust it automatically to improve performance. If you need to use Aspose.Cells to automatically match row heights when loading files, you can achieve this through the parameter LoadOptions.AutoFitterOptions.OnlyAuto.

Please refer to the following image. We can observe that the cached row height in row 11 is 15, but Excel automatically adjusts the row height when loading the file.

Adjust Row Height using Aspose.Cells

If you directly load the file and save it to PDF, the data will not be fully displayed in the PDF because its cached row height is only 15.


If you set the parameter LoadOptions.AutoFitterOptions.OnlyAuto to true when loading the file, Aspose.Cells will automatically adjust the row height. The adjusted row height can effectively meet the text‑display requirements.

C# Sample Code