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.
Unfortunately, activation email could not send to your email. Please try again.

How to pass multiple ExcelWorksheetCopyFlags to AddCopy()

Thread ID:

Created:

Updated:

Platform:

Replies:

100113 Jul 5,2011 04:58 PM Jul 6,2011 09:51 AM ASP.NET Web Forms (Classic) 1
loading
Tags: XlsIO
Mark Oudesluys
Asked On July 5, 2011 04:58 PM

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



Jawahar Jeevanandan J [Syncfusion]
Replied On July 6, 2011 09:51 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;