The Copy(sourceSheet) Method of the Aspose.Cells.Worksheet class does not appear to copy the Themes/Theme colors from the source Workbook that contains sourceSheet to the intended Destination Worksheet.
Manually copying the source Workbook Theme's colors from the source Workbook to the Destination Workbook via code like this below does not change the colors in the Destination Workbook and Worksheets. Can you let me know if this is an issue or have I missed something.
I was wondering if you found out what went wrong with your attempt to copy theme colors from a source file to a destination file? We are actually trying to do the same thing although slightly differently, but the result is the same; The destination file doesn’t have the source file’s settings.
Note: we are calling “Workbook.CustomTheme()” method only.
We appreciate if you could paste your sample code or attach a sample console application (you may zip prior attaching here) with your template files here, we will check your issue soon. If we found the issue, we will log it into our database, so your issue could be fixed soon.
I have attached a small project that opens two excel files, then attempts to copy the theme from the first excel file “test theme source.xlsx” into the second file “test theme destination.xlsx”. So you can see the original copy of the “test theme destination.xlsx” after the test run, running the poject actually generated a new file called “generated file.xlsx” in the same folder as the “test theme destination.xlsx”.
Please run the attached project. This will display a window with two text boxes paired with buttons “…”, and a large button “Copy Theme” that will execute the theme copying code. To select the source file, click the “…” button next to its text box and select the attached file “test theme source.xlsx”. Similarly, you can select the destination file using the button next to its TextBox. When you have both file locations visible in the textboxes, click the button called “Copy Theme”.
The result of the steps above will be that an excel file called “generated file.xlsx” is generated in the same folder as the destination file “test theme destination.xlsx”. The generated file actually copies the source files color scheme when you look at the generated file closely, but the theme is not actually selected in the themes list.
I have not got access to your attached files...not sure if this is intended, but if you can or would like to re-send and give me access I'd be happy to look at them in light of the issues I have raised, and if I can throw some light on the problem then would be happy to.
Sorry, I can't find any setting that will release my attached files to you. To put your mind at ease the project I have attached is basically the same as your code, except I don't have the following block.
Thanks for the template files and sharing the sample project
I can notice the issue as you have mentioned. The theme is not copied properly from the source workbook to destination workbook as you have pointed out. I tested by using the sample project attached by you with your template file.
I have logged a ticket with an id “CELLSNET-41646” for your issue. We will look into your issue to figure it out soon.
Can you please tell me what the workbook.CopyTheme method does? I have to copy the chart settings, cell formatting , font ,colors etc from an existing workbook(like a template) to a new one and change only the data in the new one.
Well, I am afraid, Workbook.CopyTheme would not suit your needs as it only copies Font attribute(s) from the source to the destination workbook, it will not copy cells formatting and chart objects. The best way to cope with it is you have to use Range.CopyStyle() or Range.Copy() method. Please see detailed document with sample code example to demonstrates the usage here.