Hi, I understand the ultraGridExcelExporter will export the grid as it appears on the screen...
Some columns on my grid use lookup tables (ValueLists), and I would like the export to export the actual value, not the text shown in the grid. Is there any option to make it happen?
Thank you
Hello Monica,
By default the grid will export the ValueLists. There is an exposed property of the ultraGridExcelExporter - ExportValueLists, which can be used to switch between which value to be exported.
Should you need further help, please let me know.
Sincerely,Tihomir TonevAssociate Software DeveloperInfragistics
Hi Tihomir,
Thank you for your reply, but I think you're mistaken or miss understood my question.
When I use the boolean ExportValueLists property, if set to true, it exports and the (display) values on my valuelist to excel, like trying to mimic the dropdown in the grid, if not, it exports only the displayMember values in the column.
In my scenario, I have a list of objects on my ValueList, I display the property Name of my object (DisplayMember) to the user and save (ValueMember)
ie.:
I would like the valuemember to be exported to excel, not the displayMember. Do you know of a way to accomplish this?
Thank you.
That's an extremely complicated way of doing it. And you run the risk of losing any layout properties that were in your original grid that you now have to copy into the new grid. The Exporter already essentially does this for you. It doesn't create a whole new grid - but it clones the grid's DisplayLayout. It does this specifically so that you can modify the export layout without affecting the on-screen grid for situations exactly like this one. :)
I think using the cellExported event would work, but I've already implemented a different solution.
I created a new temporary grid, added my dataTable to it and exported it. I only need a dump of my dataTable...
Thank you for your reply
Hey Monica,
In case you want to export the ID of the object(its a bit confusing so I'm sorry if I am not getting it right), you can hook to the cellExported event of the ultraGridExcelExporter and place reverse logic based on the value of the cell.
It will look similar to this:
private void ultraGridExcelExporter1_CellExported(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.CellExportedEventArgs e) { if (e.GridColumn.Key == "valueListColumn") { string cellValue = (string)e.GridRow.GetCellValue(e.GridColumn); // get object by property name from the valuelist WorksheetRow worksheetRow = e.CurrentWorksheet.Rows[e.CurrentRowIndex]; WorksheetCell worksheetCell = worksheetRow.Cells[e.CurrentColumnIndex]; worksheetCell.value = valueToBeExported; } }
Please let me know if this doesn't work.