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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cell background colors?

Thread ID:

Created:

Updated:

Platform:

Replies:

54126 Jan 2,2007 04:31 PM UTC Jan 3,2007 01:41 PM UTC WinForms 1
loading
Tags: XlsIO
Ryan
Asked On January 2, 2007 04:31 PM UTC

I need to specify the background colors of a range of cells however there seems to be a conflict between the colorindex values used in excel and the colorindex values used in XlsIO.

For example, the color index value of 36 should return a light yellow, however I seem to be getting a purple color instead.

I'm referring to the following page for excel color index values:
http://www.mvps.org/dmcritchie/excel/colors.htm
If you scroll down to "Color 36", you'll notice it's the light yellow color I'm looking for.

Here's the code I'm using to try to set the color to light yellow:
ExcelKnownColors knownEnm = (ExcelKnownColors)36;
range.CellStyle.ColorIndex = knownEnm;

What code should I be using so the color index values do in fact follow excel's color pallette?

Thanks.

-Ryan

Melba Winshia [Syncfusion]
Replied On January 3, 2007 01:41 PM UTC

Hi Ryan,

I was able to reproduce the problem. However our custom color starts from 0 and excel color starts from 1. So excel color index value of 36 is equivalent to XlsIO color index value of 35. Use the following code snippets to set light yellow for the cell background.

[C#]

sheet.Range["A1"].CellStyle.ColorIndex=ExcelKnownColors.Custom35;

Please take a look and let me know if you have any other questions.

Thanks,
Melba

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.

Warning Icon 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.Close Icon

;