AutoFit Rows for Merged Cells

How to use AutoFitMergedCellsType for autofitting rows

Aspose.Cells supports this feature through the AutoFitterOptions.AutoFitMergedCellsType API. Using this API, it is possible to auto‑fit rows in a worksheet including merged cells. Here is a list of all possible types of auto fitting merged cells:

  • None
  • FirstLine
  • LastLine
  • EachLine

Autofit Rows for Merged Cells

Please see the following code; it creates a workbook object and adds multiple worksheets. Different methods are used for autofit operations in each worksheet. The screenshot shows the results after the execution of the sample code.


C# Sample Code