Hi,
I am using win UltraGrid to export table in excel. My problem is when I am trying to export Image column in excel sheet. its not being exported.
In the excel, Column shows "System.Drawing.Bitmap".
I'm wondering if there is a way to export image in excel. Please help me ASAP
Currently, the grid exporter does not support the exporting of images. However, image support was added to our Excel engine in the 7.2 release, so you can export these manually. However, images in an Excel worksheet are not associated with cells, they are just sitting on top of the worksheet, so some work will need to be done to fake like the images are in the cells.
First, handle the CellExported event of the exporter. If the value of the grid cell being exported is an Image or Bitmap, then you can place that image on the worksheet over the corresponding Excel cell. Create a new Infragistics.Excel.WorksheetImage to hold the image for the cell. Set the TopLeftCornerCell and the BottomRightCornerCell properties of the WorksheetImage to the Excel cell. Then set the TopLeftCornerPosition to PointF.Empty and the BottomRightCornerPosition to new PointF(100,100). This will place the top-left corner of the image at the top-left corner of the cell and the bottom-right corner of the image at the bottom-right corner of the cell. Set the PositioningMode to ShapePositioningMode.MoveAndSizeWithCells so the images will stay above the cells even if the user resizes rows and columns. Then set the size of the rows and columns based on the image size.
I would also recommend submitting a feature request for doing this automatically: http://devcenter.infragistics.com/Protected/RequestFeature.aspx.
I'm having a little trouble getting this working. I've done the below and it all seems to "work" in that I get no exceptions etc., but no images are on the spreadsheet. I noticed that in my eImg object, the worksheet property is null - does this need setting somehow?
void
if (e == null) return;
if (e.GridColumn.Key == "BTImage")
{
Infragistics.Win.UltraWinGrid.
];
System.Drawing.
PlaceImage(bmp, e);
}
{ }
Infragistics.Excel.
eImg.TopLeftCornerCell = e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex];
eImg.BottomRightCornerCell = e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex];
eImg.TopLeftCornerPosition =
eImg.BottomRightCornerPosition =
eImg.PositioningMode = Infragistics.Excel.
Hi I'm trying to add an image to a worksheet but have no luck. I have read several posts on the infragistics forums but none of them use Excel engine in the 7.1 release. Can someone assist me in adding an image to worksheet in this specific version? I’ve tried the WorksheetImage but this is not available in the current version that I’m using. Any suggestions welcome.
Thank you very much. I have impleted with your idea and working fine.