Tab color not same as source in destination workbook


Hi Team,

I have several excel templates in which I fill the data in run time and move particular tabs from them to a new and single workbook. I am trying to make sure tab color of all the tabs in the final book should be one. But somehow it’s ending up as different color for few tabs in the final workbook.

Here is the code i have. Please advise. Thanks.

        // Add a new sheet of type of source
        Worksheet destSheet = destBook.Worksheets.Add(srcSheet.Name);
        // Copy the contents of source sheet into newly added destination sheet
        destSheet.Copy(srcSheet, GetCopyOptionsObject());

        // Copy the page setup 
        destSheet.PageSetup.Copy(srcSheet.PageSetup, GetCopyOptionsObject());
        destSheet.PageSetup.PrintArea = srcSheet.PageSetup.PrintArea;
        destSheet.TabColor = srcSheet.TabColor;




Thanks for the code segment and details.

Please try using our latest version/fix: Aspose.Cells for .NET v19.6.x if you are not already using it. If you still find the issue with v19.6.x, we need to evaluate your complete code (runnable) and trace the issue. Either create a simple console demo (runnable) application (you may zip the project with template files prior attaching here) and provide us or paste your complete simulation code and attach the template file(s) (which could be executed seamlessly to reproduce the issue). We will check your issue soon.