AutoFit Columns and Rows while loading HTML in Workbook

Possible Usage Scenarios

You can autofit columns and rows while loading your HTML file inside the Workbook object. Please set the HtmlLoadOptions.AutoFitColsAndRows property to true for this purpose.

AutoFit Columns and Rows while loading HTML in Workbook

The following sample code first loads the sample HTML into Workbook without any load options and saves it in XLSX format. It then again loads the sample HTML into Workbook but this time, it loads the HTML after setting the HtmlLoadOptions.AutoFitColsAndRows property to true and saves it in XLSX format. Please download both the output excel files i.e.Output Excel File Without AutoFitColsAndRows and Output Excel File With AutoFitColsAndRows. The following screenshot shows the effect of HtmlLoadOptions.AutoFitColsAndRows property on both output excel files.

todo:image_alt_text

Sample Code