RemoveUnusedStyles doesn't work as expected on Table Style

Hi Aspose,

I’m using Aspose Cell .NET 17.8 and would like to remove unused styles in XLS, but it doesn’t work correctly on Table Style.

The original file has 4 custom Cell Styles (1 unused) and 3 custom Table Styles (1 unused).
When calling RemoveUnusedStyles and saving to a new XLS, I expect that the new output file retains 3 custom Cell Styles and 2 custom Table Styles. Nevertheless, there’s only 1 custom Table Styles remaining, even if I don’t call RemoveUnusedStyles.

Please help me check the attachments.
sample.zip (4.3 KB)

Thank you,
Dung H. Nguyen

@dunghnguyen,

Thanks for providing us template file and details.

After an initial test, I am able to reproduce the issue as you mentioned by using the following sample code with your template file. I found that Workbook.RemoveUnusedStyles() method does not work as expected on Table styles. When calling RemoveUnusedStyles and saving to a new XLS file format, the new output file should retain 3 custom Cell Styles (which Aspose.Cells does) and 2 custom Table Styles (But Aspose.Cells does contain only 1 custom Table Styles remaining):
e.g
Sample code:

   Workbook workbook = new Workbook("e:\\test2\\sample.xls"); 
            workbook.RemoveUnusedStyles(); 
            workbook.Save("e:\\test2\\out1.xls");

I have logged a ticket with an id “CELLSNET-45613” for your issue. Our concernd developer from product team will look into it to figure it out soon.

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

Thank you.

@dunghnguyen,

This is to inform you that we have fixed the issue regarding table style that is lost when opening and saving the file. But, I am afraid, we do not support removing unused table styles in RemoveUnusedStyles method

Once the fix is available for public use, we will share the Download link here for your testing.

Thank you.

Hi @Amjad_Sahi,

I really appreciate your work :grinning:
Hope it will be released soon.

Can I ask you a question about PowerPoint?
How can I remove unused custom Styles from PPT? Does Aspose provide a similar API ?

Regards,
Dung H. Nguyen

@dunghnguyen

Thanks for using Aspose APIs.

This question is related to Aspose.Slides forum. Please post it there and Aspose.Slides team will help you in this regard.

Aspose.Slides Forum Link:

@dunghnguyen

Please download and try the latest fix and let us know your feedback.

Hi @shakeel.faiz

Thank you, but it doesn’t work as expected.
When calling RemoveUnusedStyles and saving to a new XLS file format, the new output file should retain 3 custom Cell Styles (which Aspose.Cells does) and 2 custom Table Styles (But Aspose.Cells does not remove any unused custom Table Styles. There’re 3 remaining)

Regards,
Dung H. Nguyen

@dunghnguyen,

Well, Aspose.Cells currently only supports to remove unused Cell styles. I am afraid, removing unused Table styles is not supported, we might support it later on. In this fix, we only fixed the issue regarding lost table style. Please see my previous reply:

Hi @Amjad_Sahi,

I got it. When I saw

I thought that you will provide another method :grinning:

Thank you so much.
When will this fix, missing custom Table Styles, released officially?

Regards,
Dung H. Nguyen

@dunghnguyen,

I cannot commit any time frame at the moment. We got to first discuss with the concerned developer from product team if this is feasible to be supported. I will do it and then may let you know but it is not going to be supported any time soon.

We will get back to you soon.

Thank you so much, @Amjad_Sahi

The issues you have found earlier (filed as CELLSNET-45613) have been fixed in Aspose.Cells for .NET 17.9.

Glad to hear that.
Thank you