Hi Guys!
I have a UltraWebGrid which can also be exported into an excel.
At one Column I have a image inside.
When I am exporting the grid now, you can see the html-string inside the column instead of the image, like <img ..... />.
I found an event called CellExporting. Is it possible to check if the image column is just exported and replace the html string with a text?
I am trying like this, but I don't know you to continue:
protected void UltraWebGridExcelExporter1_CellExporting(object sender, Infragistics.WebUI.UltraWebGrid.ExcelExport.CellExportingEventArgs e) { if ( ((UltraGridColumn)sender).Header.Title.Equals("Status") ) { // how to replace the html-string with a text (active, inactive) and export cell to excel } }
I checked the forum here, but i didn't found a solution. Please help me.
Hello Nikifor,
thank you, it's working now.
The main difference was that I must take the CellExported method instead of the CellExporting.
For ther other users, here is the code:
protected void UltraWebGridExcelExporter1_CellExported(object sender, Infragistics.WebUI.UltraWebGrid.ExcelExport.CellExportedEventArgs e) { e.CurrentWorksheet.Columns[7].Width = 4000; // don't check header row and only check the status column (7th column) if (e.CurrentRowIndex > 0 && e.CurrentColumnIndex == 7) { // don't check empty strings like in footer row if (e.Value != null && !String.IsNullOrEmpty(e.Value.ToString())) { if (e.Value.ToString().Contains("inactive")) { e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex].Value = "inactive"; } else { e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex].Value = "active"; } } } }
Hello Isco,Please let me know if you have further questions about this support ticket.
Hello Isco,Please take a look at the following forum thread http://forums.infragistics.com/forums/t/58967.aspx where on CellExported the value of the cell is being modified. It describes how to hyperlink but your situation is similar. You will have to check if the cell is image and replace the value on true condition.