Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
975
Export Image in Excel
posted

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

 

 

 

Parents
  • 44743
    Verified Answer
    posted

    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.

Reply Children