We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to pass multiple ExcelWorksheetCopyFlags to AddCopy()

Hi,

I was trying to pass multiple ExcelWorksheetCopyFlags to the AddCopy() function. Basically I want to pass the .CopyAll and .CopyPalette flags, as .CopyAll doesn't include the palette.

The command line currently looks like this:
wsPage = destWorkbook.Worksheets.AddCopy(sourceTemplate.Worksheets[0], ExcelWorksheetCopyFlags.CopyAll);

I want to pass something like this:
ExcelWorksheetCopyFlags[] wksFlags = { ExcelWorksheetCopyFlags.CopyAll, ExcelWorksheetCopyFlags.CopyPalette };
wsPage = destWorkbook.Worksheets.AddCopy(sourceTemplate.Worksheets[0], wksFlags);

But it doesn't like this. Any ideas?

Thanks,
Mark



1 Reply

JJ Jawahar Jeevanandan J Syncfusion Team July 6, 2011 01:51 PM UTC

Hi Mark,

Thank you very much for using syncfusion products.

We don't provide support to copy custom colors set in the workbook through CopyAll flags. The following code snippet will help you to copy the custom colors to destination workbook.

Code Snippet(C#):

dWorkbook.Worksheets.AddCopy(sWorkbook.Worksheets[0], ExcelWorksheetCopyFlags.CopyAll|ExcelWorksheetCopyFlags.CopyPalette);

I have also attached the work around sample with this update. Please try this at your side and let us know if this helps you.

Please let us know if you have any clarifications.

Thanks,
Jawahar.



CopySheet_613b0fe2.zip

Loader.
Live Chat Icon For mobile
Up arrow icon