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.

Excel export color

Thread ID:





88054 Jul 14,2009 06:38 AM Jul 17,2009 03:15 AM Windows Forms 1
Tags: GridControl
Philip Grzegorczyk
Asked On July 14, 2009 06:38 AM


i try to export my grid to Excel. But if I use the Color.fromargb() function, Excel does not show the correct Color, such as openoffice. Must I set a converter option or something else?


Rajadurai C [Syncfusion]
Replied On July 17, 2009 03:15 AM

Hi Philip,

Thanks for your interest in Syncfusion Products.

The XlsIO has a color palette where it has the collection of colors holded in ExcelKnownColors enumerator. These colors are the defined colors to be displayed in the Excel Sheet. If the exported color is not in the ExcelKnownColor then it will take the closest of the RGB values which is available in it.

For Example,
If we have one color r1, g1, b1 and another color r2, g2, b2 then we evaluate difference as (r1-r2)*(r1-r2) + (g1-g2)*(g1-g2)+(b1-b2)*(b1-b2). The smaller this values is, the closer colors are. Hence the exported color is not providing the same color in the Excel as it is in the Grid if the color value supplied through FromArgb funtion not exactly matches the known color.



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.