I have a excel report with SpreadsheetGear
component and get data from dataTable. one of column is true/false. I want to set background color for my celles dynamically
if my data is true the background color must be red and if false the color must be yellow.
string fileName = @"C:\Temp\1.xlsx";
// Create a new workbook and worksheet.
SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook();
SpreadsheetGear.IWorksheet worksheet = workbook.Worksheets["Sheet1"];
worksheet.Name = "Spice Order";
// Get the top left cell for the DataTable.
SpreadsheetGear.IRange range = worksheet.Cells["A1"];
// Copy the DataTable to the worksheet range.
range.CopyFromDataTable(parentDataTable, SpreadsheetGear.Data.SetDataFlags.None);
// Auto size all worksheet columns which contain data
worksheet.UsedRange.Columns.AutoFit();
worksheet.SaveAs(fileName, FileFormat.OpenXMLWorkbook);