Hello,
I have some ConditionalFormatRules for xamGrid (11.1) to add icons to cells. And I want to export this icons to Excel. So I get icon from
(row.Cells[i] as ConditionalFormattingCell).Control as ConditionalFormattingCellControl
and everything is ok. But if option xamGrid.GroupBySettings.GroupByOperation is set to GroupByOperation.GroupByRows then (row.Cells[i] as ConditionalFormattingCell).Control is null and I can't get icon from it.
I have been looking into your issue and would you please provide me with your sample application in order to investigate this behavior ?
Looking forward to hearing from you.
We use the following code to export icons to MS Excel
foreach (Column column in this.grid.Columns.AllVisibleChildColumns) { var conditionalFormattingCell = row.Cells[column] as ConditionalFormattingCell; if (conditionalFormattingCell != null) { ConditionalFormattingCellControl cellControl = conditionalFormattingCell.Control as ConditionalFormattingCellControl; if (cellControl != null && cellControl.Icon != null) { BitmapImage image = new BitmapImage(); image.CreateOptions = BitmapCreateOptions.None; image.UriSource = ((cellControl.Icon.LoadContent() as Image).Source as BitmapImage).UriSource; WriteableBitmap writeableBitmap = new WriteableBitmap(image); WorksheetShape worksheetShape = new WorksheetImage(writeableBitmap, new PngImageEncoder(), null); worksheetShape.PositioningMode = ShapePositioningMode.MoveWithCells; WorksheetCell cell = sheet.Rows[startRow].Cells[currentColumn + startColumn]; worksheetShape.TopLeftCornerCell = cell; worksheetShape.TopLeftCornerPosition = new Point(0.0F, 0.0F); worksheetShape.BottomRightCornerCell = cell; worksheetShape.BottomRightCornerPosition = new Point(33, 40); workSheet.Shapes.Add(worksheetShape); } } this.SetCellValue(sheet.Rows[startRow].Cells[currentColumn + startColumn], row.Cells[column] as Cell); currentColumn++; }