using IronXL;
using IronXL.Options;
WorkBook workBook = WorkBook.Load("sample.xlsx");
var options = new HtmlExportOptions()
{
// Set row/column numbers visible in html document
OutputRowNumbers = true,
OutputColumnHeaders = true,
// Set hidden rows/columns visible in html document
OutputHiddenRows = true,
OutputHiddenColumns = true,
// Set leading spaces as non-breaking
OutputLeadingSpacesAsNonBreaking = true
};
// Export workbook to the HTML file
workBook.ExportToHtml("workBook.html", options);
Imports IronXL
Imports IronXL.Options
Private workBook As WorkBook = WorkBook.Load("sample.xlsx")
Private options = New HtmlExportOptions() With {
.OutputRowNumbers = True,
.OutputColumnHeaders = True,
.OutputHiddenRows = True,
.OutputHiddenColumns = True,
.OutputLeadingSpacesAsNonBreaking = True
}
' Export workbook to the HTML file
workBook.ExportToHtml("workBook.html", options)
Install-Package IronXL.Excel
將 Excel 轉換為 HTML
上述代碼範例展示了如何在 C# 中將 Excel 轉換為 HTML。使用 HtmlExportOptions 類來自訂 HTML 輸出的方式。可用的選項如下: