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

Free Support Forum - aspose.com

"RemoveUnusedStyles" function seems to remove used styles in Aspose.Cells version 21.9.0

Howdy,
It appears that workbook.RemoveUnusedStyles() function removes styles from “edge” cells sometimes.
I am attaching spreadsheet for which it happens. Even though it is very simple it has a few regions defined, hence the problem I guess.
Here it the code to duplicate the issue.
var myFile = @“PutThePathToAttachedFileHere”;
Workbook wb = new Workbook(myFile);
//If you comment out the line below everything seems to be working
wb.RemoveUnusedStyles();
var htmlSaveOptions = new HtmlSaveOptions
{
CellCssPrefix = “Av”,
ExportActiveWorksheetOnly = true,
ExportImagesAsBase64 = true,
PresentationPreference = true,
};
wb.Save(myFile, htmlSaveOptions);

OK, somehow I can not upload “.xlsx” file …TestAsPoseExcel_Net_20_6_0_0.zip (7.1 KB)
Zipped the file and uploaded …

@bogdanw,
Thank you for posting your query. Please spare us a little time to analyze it. Is this query the same as posted by you here as well right now?

  • https://forum.aspose.com/t/problem-with-aspose-cells-21-9-0-aspose-assistant-conversation-with-customer-on-friday-october-8th-2021-357-pm/236248

I figured out that I have to zip my Excel file.
The issue is described at:

https://forum.aspose.com/t/removeunusedstyles-function-seems-to-remove-used-styles-in-aspose-cells-version-21-9-0/236247

@bogdanw,
Could you please share more details about this issue like mark the exact style that is used but removed by this function?

If you look at the resulting .html file, you will notice that the left upper cell of the table has no border.
Others cells have it.
This is caused by the fact that the cell class ( I mean css class) is not in the (html) file.
It is removed by the call to “RemoveUnusedStyles”.

@bogdanw,
I am afraid that I am still not able to locate the exact location where this missing border is to be observed. Here is a comparison image of output HTML files. The right side image is where RemoveUnusedStyles is called whereas the left side image is where this function is commented. Please mark the exact line where this border is missing for our reference. I can see that the CSS file is missing when this function is called but we exactly want to know the line having issues due to the missing CSS file.
image.png (735.1 KB)

It appears that this problem came back in the version 21.12.0 … possibly it has never been fixed.
Anyhow, attaching two pictures’ with a simple grid. One is created with a call to “RemoveUnusedStyles”, the other without this call.Aspose_Cells_21_12_0_With_Calling_RemoveUnusedStyles.png (3.3 KB)
Aspose_Cells_21_12_0_Without_Calling_RemoveUnusedStyles.png (3.4 KB)
Please note differences in the top left cell plus aligning issues on the third row.

@bogdanw,

We noticed the difference as you pointed out. But we need your template Excel file and output HTML(s) as it looks like you are using some different Excel file. Also, paste your sample code that you are using to reproduce the issue on our end, we will check it soon.

PS. please zip the files prior attaching here.

Try this one please.Aspose_21_12_0_Short_Test_Report_02_09_22.zip (10.1 KB)
Please keep in mind that the code is .NET CORE so references have to be put to proper version of Aspose Cells.

@bogdanw,

We reproduced the issue using your template file. We logged a ticket with an id “CELLSNETCORE-362” for your issue. We will look into it soon.

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

@bogdanw,

This is to inform you that your issue has been resolved. The fix will be included in our upcoming release, Aspose.Cells for .NET 22.3. The next release will be released in the second week of March 2022. You will also be notified when a new release is published.