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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Light Green does not work when exporting to excel with XlsIO

Thread ID:





94895 Jun 9,2010 03:28 AM UTC Jun 15,2010 11:22 AM UTC ASP.NET Web Forms (Classic) 4
Tags: XlsIO
Joseph Takahata
Asked On June 9, 2010 03:28 AM UTC

Light green does not work. It exports as grey.

range.CellStyle.Color = Color.LightGreen;
//Where range is an IRange for any sheet

This will not result in the background color to the range being Light Green.

Has anyone found a solution or work around for this? I have very picky users and unfortunately have to use LightGreen.

Thank you.

Joseph Takahata
Replied On June 9, 2010 02:41 PM UTC

No one has heard of this?

Here is a section of code you can use to get the same results:

using Syncfusion.XlsIO;
public void WriteToExcel()
//Instantiate the spreadsheet creation engine.
ExcelEngine excelEngine = new ExcelEngine();
//Instantiate the excel application object.
IApplication application = excelEngine.Excel;
//A new workbook is created.[Equivalent to creating a new workbook in MS Excel]
//The creation of a new workbook in the excel file
IWorkbook workbook = application.Workbooks.Create(1);
//The first worksheet object in the worksheets collection is accessed.
IWorksheet sheet = workbook.Worksheets[0];

//Select a range and would expect to make the back color LightGreen
IRange range = sheet["A1:A6"];
range.CellStyle.Color = Color.LightGreen;

//Saving the workbook to disk.
//Close the workbook.
//No exception will be thrown if there are unsaved workbooks.
excelEngine.ThrowNotSavedOnDestroy = false;

This will create the attached file. Which you'll notice does not have light green as the fill color for A1 to A6.


Lokesh R [Syncfusion]
Replied On June 10, 2010 05:04 AM UTC

Hi Joseph,

Thank you very much for your interest on Syncfusion products.

We are very sorry for the delay caused in getting back to you.For your information Excel could not able to detect the System color to the Excel color, So setting the color property will give you in irrelevant output. We recommend you to use the ColorIndex property instead of Color ,the ColorIndex Property accepts the ExcelKnownColors value. Could you please do the below modifications in your code snippet and let us know if this helps you.

[C#] Code Snippet:
IRange range = sheet["A1:A6"];
range.CellStyle.ColorIndex = ExcelKnownColors.Light_green;

Please, let us know if you need any clarifications.


Willis Logwood
Replied On June 11, 2010 07:52 PM UTC

Does this mean you can't do your own custom colors?

Lokesh R [Syncfusion]
Replied On June 15, 2010 11:22 AM UTC

Hi Joseph,

Yes, it is possible to define our own custom colors, we have an another property FillBackgroundRGB which accepts the System.Drawing.Color values ,but we strongly recommend you to use the ColorIndex property and for more information regarding the color and fill settings please navigate to the below online documentation link.

Online link:

Please, let me know if you need any clarifications.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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