Free Support Forum -

AutoFitRows UnHides hidden rows

Good day

When I hide rows with:

Aspose.Cells.Worksheet ws = wb.Worksheets[0];


and export via:

Aspose.Cells.Rendering.ImageOrPrintOptions iopo = new Aspose.Cells.Rendering.ImageOrPrintOptions();

Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(ws, iopo);

the export is fine, with the hidden row not shown.

But if I autofit the rows with:

Aspose.Cells.AutoFitterOptions autofit = new Aspose.Cells.AutoFitterOptions(); autofit.AutoFitMergedCells = true; ws.AutoFitRows(autofit);

before the export, the hidden rows are shown again.

The AutoFit resets the visible setting on the rows.


Please try the below source code for your scenario. Also attached to my reply is the input and output files for your reference. Feel free to write back. Thank you

C# Sample Code:

Workbook book = new Workbook(“C:\temp\book1.xlsx”);

Worksheet sheet = book.Worksheets[0];


AutoFitterOptions options = new AutoFitterOptions();

options.AutoFitMergedCells = true;

options.IgnoreHidden = true;



Perfect, thanks.