I have a custom summary displayformatter where I take the input, which is number of seconds, and convert it to a text representation of days/hours/minutes/seconds. For example 11340 becomes "0003h:09m:00s".
I am trying to export the text representation of that and not the 11340. I have tried both the SummaryCellExporting and SUmmaryCellExported wich this code...
if
(e.Summary != null)
{
e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex].Value = e.Summary.SummaryText.ToString();
}
Yet it still exports 11340 as the value in the cell. What do I need to do to have it export the text?
The code you have here should work in the SummaryCellExporter event (although it will not work in SummaryCellExporting). The only reason I can think of why this would not work is if the summary is being calculated with a formula. In that case, the Formula may be overriding the Value on the cell. Check the Excel file and see if there is a formula on the cell. If so, you will need to also remove the formula in addition to setting the Value.
Thanks Mike!
It indeed was a formula and this little nugget of code fixed the issue.
ultraGridExcelExporter1
.ExportFormulas = false;