AutoFit Rows for Merged Cells

How to use AutoFitMergedCellsType for autofitting rows

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

  • NONE
  • FIRST_LINE
  • LAST_LINE
  • EACH_LINE

Autofit Rows for Merged Cells

Please see the following code; it creates a workbook object and adds multiple worksheets. It uses different methods for autofit operations in each worksheet. The screenshot shows the results after executing the sample code.


Python Sample Code