Free Support Forum -

Copying color palette in Aspose

Hi Team, Can you please help me with code for applying color palette of a source workbook to destination workbook. My source workbook I guess is from 2010 version but since I am creating new workbook and saving it after processing, its carrying latest color palette.

I want to copy down color palette setting of source to destination workbook.


Thanks for your query.

We are not sure about your issue/requirements, kindly do elaborate your requirements and provide us sample files (input and output files, etc.) and sample code (runnable). Also, provide your expected file (which you can create manually in MS Excel). Moreover, how could you accomplish the task in MS Excel? Please also provide some screenshots to highlight issue and exhibit your needs, this will help us really to understand your requirement to consequently figure it out soon.


Equivalent VBA for this requimrent is

wbkDestReport.Colors = wbkSourceTemplate.Colors



Just to eloberate my requirement, I have some color applied as tab color in source template workbook. I move some of the tabs from source template to a newly created workbook (destination report) and save down. I am getting new colors in destination. To fix this problem, the work around is, while saving, we should be able to copy color palette settings (on whole) from a workbook to another workbook. Let me know if you still do not understand. Thanks.


As requested earlier, please provide us your source template file and an expected output file which you create using Excel. Also provide the steps in detail to produce expected output file from template file and any sample code(runnable) for our testing.


I guess you may try to use Workbook.CopyTheme() method to copy them (with colors) from source workbook to destination workbook, see the sample line of code for your reference;
Sample code:


Hope, this helps a bit.