I'm trying to add a background to a cell that I'm exporting from a XamDataGrid to Excel.
In the CellExporting event, I'm conditionally applying a formula, then setting the fill.
This works fine for cells without a formula, however, the color is not showing on cells that contain formulas. What do I need to change?
private void grid_CellExporting (object sender, CellExportingEventArgs e){ var cell = e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex];
...
if (hasFormula) { cell.ApplyFormula(formula); } ...
e.FormatSettings.FillPatternBackgroundColor = Color.Yellow; e.FormatSettings.FillPatternForegroundColor = Color.Yellow; e.FormatSettings.FillPattern = FillPatternStyle.Solid;}
Hello, Thank you for contacting Infragistics. When adding formula for cells in the the worksheet that don't correspond to cells in the grid you'll need to use the CellFormat as demonstrated attached. Let me know if you have any questions.
DataGridExportToExcelStylesColumns (2).zip