When I save a workbook to HTML, the CSS styles that use the format .x will be prefixed with the string specified in the HtmlSaveOptions.CellCssPrefix property. However, other styles in the format .font, .style, and td are not prefixed. When the HTML is embedded in a page with other content, the styles from the two sources corrupt each other.
Is there a way to save the HTML without having this problem? Note that I’m not able to use an iframe or save the workbook as an image because the user is able to convert the web page to a PDF and each solution causes problems with PDF conversion.
Please provide us your sample excel file. It should be a simple excel file. Also provide us screenshots showing the wrong css and your expected css. It will help us investigate this issue properly and we will update you asap.
Please also download and try the latest version: Aspose.Cells for .NET v8.8.0.4 and see if it makes any difference and resolves your issue.
Thank you for your response. I downloaded the version that you specified but it has the same issue.
I’ve attached the files that you requested:
1) A simple Excel file (Blank.xlsx)
2) The generated HTML file (Blank.html)
3) A screenshot of the actual and expected CSS styles. I’ve prefixed all of the .style and .font styles with the same prefix used by the .x styles. I’ve also crossed out the CSS element selectors because those are what cause the problems when embedded in another HTML document.
Here is the code used to generate the HTML document:
var wb = new Workbook(@“C:\temp\ConsoleApplication7\Blank.xlsx”);
var cells = wb.Worksheets[0].Cells;
var wsUniqueId = new Random().Next(0, UInt16.MaxValue);
We were able to observe this issue as per your screenshot. The CSS styles that use the format .x are not prefixed with the string specified in the HtmlSaveOptions.CellCssPrefix property.
We have logged this issue in our database for investigation. We will look into it and fix this issue. Once the issue is resolved or we have some other update for you, we will let you know asap.
This issue has been logged as
CELLSNET-44446 - All CSS styles are not prefixed when saving as HTML
This is to inform you that we have fixed your issue CELLSNET-44446 now. We will soon provide the fix after performing QA and including other enhancements and fixes.
Good to know that your issue is sorted out by the new fix/version. Feel free to contact us any time if you have further queries or issue, we will be happy to assist you soon.
I have been having the exact same problem with Cell.Java. Not all generated styles including the requested prefix - specifically the “td” style created for displayed gridlines has no prefix and thus affects all "td"s in a page when the HTML is included.
Can I get this bug fixed in Java please.
Thank you
Mark
p.s. Here is a snipped of the generated HTML. I have specified a style prefix of “.WSI-170203-00006”
First of all, we humbly request you to create your own thread while providing the complete HTML string (preferably in a file) along with your code (preferably a console application) covering your complete scenario. This will help us manage your inquires in more efficient manner as well as understand your concerns. Before you move forward to provide us the above requested, please give a try to the latest version of Aspose.Cells for Java 17.1.8 (attached) to see if you can still replicate the issue.