I would like to convert a xlsx worksheet to HTML format. The worksheet has fewer Worksheet.MaxRows
than the specified PageSetup.PrintArea
. Therefore when converting to HTML I would like to include empty rows beyond the MaxRows
in the HTML output. When changing PageSetup.PrintArea
range to be lower than MaxRows
(e.g. only print rows 3-15, when the final row in the excel file is 20). But when I try to increase the range (print rows 3-25, when the final row is 20), it only prints up to row 20, instead of including the extra 5 empty rows.
I am using HtmlSaveOptions.ExportPrintAreaOnly
to specify the range to print.
Here's a snippet of my code:
FilePath htmlFilePath = output.GetDirPath() + output.GetFileNameWithoutExtension() + ".html";
var htmlSaveOptions = new HtmlSaveOptions
{
ExportHiddenWorksheet = false,
ExportActiveWorksheetOnly = true,
ExportPrintAreaOnly = true
};
sheet.Workbook.Save(htmlFilePath, htmlSaveOptions);
Another option I could go for is simply inserting the rows manually and removing their styling (though I seem to be having an issue applying styling but that is for another question post), but I was wondering if there is a neater, in-built way this could be done using HtmlSaveOptions
.
question from:
https://stackoverflow.com/questions/65888598/increase-the-range-of-rows-included-when-converting-from-an-excel-worksheet-to-h 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…