I am using
Aspose.Cells 25.9.0.
.NET 9.0
There is Excel file with Shapes and Icons inserted into it.
Unfortunately, when converting to HTML, Icons are not displayed.
Code:
using System.Text;
using Aspose.Cells;
using Aspose.Cells.Rendering;
var cellsLicFilePath = Path.Combine(Directory.GetCurrentDirectory(), "Aspose.Cells.NET.lic");
var cellsLic = new Aspose.Cells.License();
cellsLic.SetLicense(cellsLicFilePath);
HtmlSaveOptions options = new()
{
ExportImagesAsBase64 = true,
ExportPrintAreaOnly = true,
ExportHiddenWorksheet = false,
ExcludeUnusedStyles = true,
ExportActiveWorksheetOnly = true,
Encoding = Encoding.UTF8,
EmbeddedFontType = HtmlEmbeddedFontType.Woff
};
var input = @"C:\input_for_aspose.xlsx";
var output = @"C:\output.html";
Workbook? wbc;
using (var ms = new FileStream(input, FileMode.Open))
wbc = new Workbook(ms, new LoadOptions(LoadFormat.Xlsx));
wbc.CalculateFormula();
var range = wbc.Worksheets.Names.First(x => x.FullText == "test_icons_html").GetRange()!;
var worksheet = range.Worksheet;
worksheet.PageSetup.PrintArea = range.Address;
wbc.Worksheets.ActiveSheetIndex = worksheet.Index;
using var html = new MemoryStream();
wbc.Save(html, options);
var arr = html.ToArray();
File.WriteAllBytes(output, html.ToArray());
I noticed that if I change type in HTML for
tag from data:image/svg+xml to data:image/svg, the image will be displayed.
xlsx: input_for_aspose.zip (18.8 KB)
html: output.zip (24.6 KB)