exporting image to excel

Posted by: psthariharan on 8 September 2017, 1:58 pm EST

  • Posted 8 September 2017, 1:58 pm EST

    hi


    i am using spread 4.0. one of my left corner cells  contains logo(jpg file).


    now how can i export to excel with this image


    pls help me in this issue.


    thanks & regards 


    hariharan

  • Replied 8 September 2017, 1:58 pm EST

    Hello Hariharan,


     In order to export image to Excel you first need to the Set the CellType for that cell as ImageCellType.Below is the code snippet to do the same,


    Dim ict As New FarPoint.Win.Spread.CellType.ImageCellType


    Dim image As System.Drawing.Image = System.Drawing.Image.FromFile("D:\Books\Pics\Signatures\new.jpg")


    FpSpread1.Sheets(0).Cells(1, 1, 2, 2).CellType = ict


    FpSpread1.Sheets(0).Cells(1, 1).Value = image


    FpSpread1.SaveExcel("D:\results.xls")


     


    Hope it will help you.


    Regards, 


     

  • Replied 8 September 2017, 1:58 pm EST

    Hello,


    The code given to you is to export images that are in the Spread cells. There is not a way to have images that are in header cells to export to Excel.

  • Replied 8 September 2017, 1:58 pm EST

    scotts:

    Hello,


    The code given to you is to export images that are in the Spread cells. There is not a way to have images that are in header cells to export to Excel.



    Can this code be used to export an image in an Excel 2007 format?

  • Replied 8 September 2017, 1:58 pm EST

    Hello,

    No the above snippet would not work with Excel2007 as for ImageCellType the images are exported as shapes in BIFF8 format which is supported by (Excel97,Excel2000 etc),whereas Excel2007 supports different format.

    Thanks

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels