Hi -
I have a dataset bound to an ultrawingrid. One of the column [Status] is assigned a ValueList which contains only two values - Approved or UnApproved. Depending on the value for each row, I display an Image in the Status column cell for that particular row. and I am using the following code
statusList.DisplayStyle = ValueListDisplayStyle.Picture; e.Layout.Bands[0].Columns["MapStatus"].ValueList = statusList; e.Layout.Bands[0].Columns["MapStatus"].CellActivation = Activation.NoEdit;
where statusList is my ValueList.
Now when I export the rows to excel,I am expecting the actual value [ie either Approved/UnApproved] to be exported to excel, which is not happening.The column is empty when exported. Is there something that I am missing here or how do we accomplish this..?
Thanks
Rajesh
Hi Rajesh,
What version of the controls are you using?
What are the contents of the ValueList? Are you populating the list with items that have both a DataValue and DisplayText?
Thanks for your time Mike
The version is 9.2
Following is the code that I have in the Initializelayout event of the Grid
// Create a ValueList with an image for each item. ValueList statusList = e.Layout.ValueLists.Add("Status");
ValueListItem vli = statusList.ValueListItems.Add("Approved");vli.Appearance.Image = XYZ.Resources.Approve;
vli = statusList.ValueListItems.Add("UnApproved");vli.Appearance.Image = XYZ.Resources.Denied;// Set the DisplayStyle to Picture so that the list displays only pictures, and no textstatusList.DisplayStyle = ValueListDisplayStyle.Picture;// Assign the ValueList to the column and disable Edite.Layout.Bands[0].Columns["MapStatus"].ValueList = statusList;e.Layout.Bands[0].Columns["MapStatus"].CellActivation = Activation.NoEdit;
And then I bind the dataset which contains a column named 'MapStatus'. I have added the Approved and Denied icons to the resource file and I set them to the valuelistitem as seen in the code above.Depending on the value [Approved/UnApproved] in the dataset, I am able to see the corresponding image displayed in the cell for the Status Column.But when I export the row, this data is missing.I am not sure whether the images get exported , but at the least the expectation is that the actual cell value [ie Approved/Unapproved] gets exported .
We had a holiday weekend here in the United States, so I didn't get to look a this until now. :)
I tried this out and I get the same results. The cells in Excel are completely blank. It looks like the UltraGridExceptExporter simply does not handle the images from the ValueList.
I am going to forward this thread over to Infragistics Developer Support so they can write it up and have it looked into. But unfortunately, version 9.2 is retired. So even if this is fixed, it will only be fixed in the latest supported versions.
You can probably work around this using the UltraGridExcelExporter's CellExported event. You can trap for the particular column you want and then write the image directly into the Excel cell based on the grid cell's Value.
private void ultraGridExcelExporter1_CellExported(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.CellExportedEventArgs e) { if (e.GridColumn.Key == "MapStatus") { string cellValue = (string)e.GridRow.GetCellValue(e.GridColumn); Image image = null; if (string.Compare(cellValue, "Approved") == 0) image = XYZ.Resources.Approve; else image = XYZ.Resources.Denied; WorksheetRow worksheetRow = e.CurrentWorksheet.Rows[e.CurrentRowIndex]; WorksheetCell worksheetCell = worksheetRow.Cells[e.CurrentColumnIndex]; WorksheetImage worksheetImage = new WorksheetImage(image); Rectangle rect = worksheetCell.GetBoundsInTwips(); worksheetImage.SetBoundsInTwips(e.CurrentWorksheet, rect, true); e.CurrentWorksheet.Shapes.Add(worksheetImage); } }
Thanks Mike for the code.Even I was heading in the same direction..That solved the issue.
Hello rajeshall,
I created the following case for you: 'CAS-84953-YR8GN5' and will update you through it about the progress of this issue.
Please do not hesitate to contact us if you need any additional assistance.
Thanks guys
Hello, After some research, the "Ability to export an image to an excel file" has been determined to be a new feature request. I have sent your feature request directly to our product management team. Our product team chooses new feature requests for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested features, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your feature is chosen for development, you will be notified at that time. Your reference number for this feature request is FR14127.
If you would like to follow up on your feature request at a later point, you may contact Developer Support management via email. Please include the reference number of your feature request in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com
Thank you for your request.