Layout breaks on MacBook in Safari
Google Chrome
Version 129.0.6668.90 (Official Build) (arm64)
image.png (20.8 KB)
Safari
Version 18.0.1 (20619.1.26.31.7)
image.png (14.5 KB)
Code
private HtmlSaveOptions HtmlSaveOptions =>
new()
{
ExportImagesAsBase64 = true,
ExportPrintAreaOnly = true,
ExportHiddenWorksheet = false,
ExcludeUnusedStyles = true,
ExportActiveWorksheetOnly = true,
Encoding = Encoding.UTF8
};
using var html = new MemoryStream();
workbook.Save(html, _htmlOptions);
File (html)
2.html.zip (86.5 KB)
@aleksandr.l,
Thank you for the sample HTML file and screenshots.
Could you please share your source file? If you are generating the HTML dynamically in code, kindly share the source code for it. We will evaluate it and log an appropriate ticket into our database to investigate the issue thoroughly.
Source (xlsx)
2.xlsx.zip (134.0 KB)
Additional code
public static void ExportHtml(string inputPath, string htmlOutputPath)
{
Workbook wbc = null;
using (var ms = new FileStream(inputPath, FileMode.Open))
{
wbc = new Workbook(ms, new LoadOptions(LoadFormat.Xlsx));
}
var range = wbc.GetRangeByNamedRange("To_Publish");
var worksheet = range.Worksheet;
worksheet.PageSetup.PrintArea = range.Address;
wbc.Worksheets.ActiveSheetIndex = worksheet.Index;
using var html = new MemoryStream();
wbc.Save(html, _htmlSaveOptions);
File.WriteAllBytes(htmlOutputPath, html.ToArray());
}
@aleksandr.l,
Thanks for the template Excel file and code snippet.
We require thorough evaluation of your issue in your mentioned environment. By the way, if you render to HTML (Web page) via MS Excel, does it also break the layout on MacBook in Safari? In any case, 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-56893
if you render to HTML (Web page) via MS Excel, does it also break the layout on MacBook in Safari?
We tried to do as you said, but we took worse layout.
via Excel.png (23.6 KB)
HTML page works fine on windows in Google Chrome and on Macbook 16’ in Google Chrome, but layout “floats” on Macbook 16’ in Safari. I think there’s a problem with spaces.
@aleksandr.l,
Thanks for sharing further details with screenshot.
It means, the issue you’re experiencing with the layout breaking or becoming distorted on a MacBook in Safari may not be directly related to Aspose.Cells, as the component adheres to Microsoft Excel standards and specifications when rendering to the HTML file format. It’s possible that the issue lies with the Safari browser. We’ll thoroughly evaluate your issue and provide you with an update soon.
@aleksandr.l ,
We are pleased to inform you that your issue has been resolved. The fix will be included in an upcoming release (Aspose.Cells v24.11) that we plan to release in the first half of November 2024. You will be notified when the next version is released.
Please note that we use “padding-left” instead of “nbsp;” in the next version.
Attached is the fixed result for your reference:
output.zip (79.9 KB)
The issues you have found earlier (filed as CELLSNET-56893) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi