Graphic elements in HTML are not displayed

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)

@aleksandr.l

The issue with icons not being displayed in the HTML output when converting from Excel using Aspose.Cells may be related to the encoding of SVG images.

You mentioned that changing the <img> tag type from data:image/svg+xml to data:image/svg resolves the display issue, indicating that the encoding format might be the cause.

To address this, you can modify the HTML output after saving it to ensure that the image tags are correctly formatted. Here’s a simple way to do that:

using System.IO;
using System.Text.RegularExpressions;

// After saving the HTML
var htmlContent = File.ReadAllText(output);
htmlContent = Regex.Replace(htmlContent, @"data:image/svg\+xml", "data:image/svg");
File.WriteAllText(output, htmlContent);

This code reads the generated HTML file, replaces the incorrect MIME type, and writes the corrected content back to the file.

If the issue persists, consider reviewing the Aspose.Cells documentation for any updates or specific settings related to SVG handling during HTML conversion.

@aleksandr.l
By testing with sample files and code on the latest version v25.9, we can reproduce the issue. Some graphic elements are not displayed when saving file to html.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-59156

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.