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,

    <FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT></FONT><FONT size=2> ict </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>New</FONT></FONT><FONT size=2> FarPoint.Win.Spread.CellType.ImageCellType


    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT></FONT><FONT size=2> image </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> System.Drawing.Image = System.Drawing.Image.FromFile(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"D:\Books\Pics\Signatures\new.jpg"</FONT></FONT><FONT size=2>)


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


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


    FpSpread1.SaveExcel(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"D:\results.xls"</FONT></FONT><FONT size=2>)</FONT>


    <FONT size=2></FONT> 


    Hope it will help you.


    Regards, 


    <FONT size=2> 

    </FONT>
  • 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

    <BLOCKQUOTE><div><img src="/wp-content/uploads/CS_images/icon-quote.gif"> scotts:</div><div>

    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.


    </div></BLOCKQUOTE>


    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