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
75
Image on First row
posted

I have an existing web Ultragrid which works fine. I'm simply trying to put an image on top of Excel sheet on Export event by trying to write the image directly on first index Rows[0].Cells[0] and whenever I do that, it throws "...is not a supported cell value type."

The code I try

  protected void exportControl_ExportXLS(object sender, EventArgs e)
        {

                Workbook wb = new Workbook();
                Worksheet ws = wb.Worksheets.Add("my Title");
                WorksheetCell wc = ws.Rows[0].Cells[0];
                System.Drawing.Image logo = System.Drawing.Image.FromFile(Server.MapPath("~/logo.jpg"));
                wc.Value = logo;   // DOESNT WORK. I need an Image on this cell.

                exportControl.XLSExport.Export(MyGrid.grid1, ws, 2, 0); // this part exported the grid fine 

       }

I Tried to set the cell value to Bitmap/JPEG object with same result. I read somewhere that I should use Appeareance.backgroundImage but the cell does not have this property..

Worksheet.Rows[0].Cells[0]....

I know this is very trivial but I'm stuck and would really appreciate any pointer. Thanks..

Parents
No Data
Reply
  • 75
    posted

    So I just see that the cell value does not accepting image. So simply, how do I insert the image to a cell? 

    http://help.infragistics.com/Help/NetAdvantage/ASPNET/2012.2/CLR4.0/html/Infragistics4.WebUI.Documents.Excel.v12.2~Infragistics.Documents.Excel.WorksheetCell~Value.html

Children