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

Free Support Forum - aspose.com

Copy theme from source workbook into target workbook in .NET

My client has defined a theme that they would like used for each workbook that is generated


How do I use a theme with Aspose.Cells to generate an Excel file and utilize the formatting and fonts in the theme?


Hi,

Thanks for your posting and using Aspose.Cells.

You can use Workbook.CopyTheme() method to copy Theme from your source workbook into your destination workbook.

Please see the following sample code that explains how to copy theme from source workbook into target workbook.

C#

string filePath = @“F:\Shak-Data-RW\Downloads\source.xlsx”;


Workbook srcWorkbook = new Workbook(filePath);


Workbook workbook = new Workbook();


workbook.CopyTheme(srcWorkbook);


workbook.Save(“output.xlsx”);

Saved workbook does not render with theme formatting of source.


What needs to be done to apply formatting from the source into the newly generated spreadsheet? This is not clear

Hi,

Thanks for your feedback and using Aspose.Cells.

It looks copying theme from one workbook to another workbook is not working as expected. Although theme is copied to destination workbook fine. If you change the extension of destination workbook to .zip and open it with WinRar and check the inner files, you will see theme is copied successfully. However, when you check it with Microsoft Excel 2010, you see no theme is selected in the menu. We will investigate this issue further and log it in our database for a fix.

Hi,

Thanks for using Aspose.Cells.

We have tested this issue with the sample code given in the above post with the source excel. Source excel file has a theme Apothecary applied but it does not get copied to destination workbook. Both source and output excel files are attached with this post.

I have also attached the screenshot highlighting this issue for a reference.

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-43821 - Workbook.CopyTheme method is not copying Theme properly

Has this been resolved?

Hi,

Thanks for your posting and using Aspose.Cells.

We are afraid, this issue is still unresolved and there is no further update for you regarding this issue at this moment. It seems to be a complex issue and might take fair amount of time. However, we have logged your comment in our database against this issue and requested the product team to provide some fix or ETA for this issue. Once there is some news for you, we will let you know asap.

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.5.2.1 and let us know your feedback.

This dll appears to pull in the Theme correctly.


Is this a production ready version of the DLL?

Hi Travas,

Thank you for the confirmation, and it is good to know that you are up & running again. Please note, 8.5.2.1 is a maintenance release, however, you can use it in your production environment as it contains all the fixes from previous releases. The next official release will be available during the 2nd week of September 2015.