I am trying to export an Excel range to HTML. The Range contains a simple object created by Excel SmartArt.
The Workbook.Save functions throws exception: "System.NullReferenceException: 'Object reference not set to an instance of an object.'
Attaching a source code and the input Excel.
try
{
var HtmlSaveOptions = new HtmlSaveOptions
{
ExportImagesAsBase64 = true,
ExportPrintAreaOnly = true,
ExportHiddenWorksheet = false,
ExcludeUnusedStyles = true,
ExportActiveWorksheetOnly = true,
Encoding = Encoding.UTF8
};
var file = "c:\\temp\\input_1_1.xlsx";
using var workbook = new Workbook(file);
var worksheet = workbook.Worksheets["Sheet1"];
var name = workbook.Worksheets.Names["DR_PUBv2__1661241747"];
worksheet.PageSetup.PrintArea = name.GetRange().Address;
workbook.Worksheets.ActiveSheetIndex = worksheet.Index;
workbook.Save("c:\\temp\\my_file.html", HtmlSaveOptions);
}
catch (Exception e)
{
}
Using Aspose for Cells, C# .Net Core, 22.12.
input_1_1.zip (15.0 KB)