We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Save Sheet to HTML with SmartArt -> Throws exception

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)

@eyalmolad,

Thanks for the sample Excel file.

Please notice, I am able to reproduce the issue as you mentioned by rendering the spreadsheet to HTML. I found when saving to HTML, it throws an exception: “System.NullReferenceException: ‘Object reference not set to an instance of an object.’”. I have logged a ticket with an id “CELLSNET-52549” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@eyalmolad,

We are pleased to inform you that your issue has been resolved. The fix will be included in our upcoming release (Aspose.Cells v23.2) which is scheduled in the first half of February 2023. Please note, the 3D effect of the shape in the sample file is still under development and cannot be supported temporarily, this will be supported in future versions.