We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Exporting to Excel 2007


I'm using syncfusion XlsIo to export image to Excel.
My original program supported this feature only to Excel 2003 and under which is a .xls file, and it worked fine.

However, now I'm trying to export the same thing to Excel 2007 which is a .xlsx file, and it ls not working.

Thank you in advance.

Here's the source code.
   ExcelEngine excelEngine = new ExcelEngine();
    IApplication application = excelEngine.Excel;
    IWorkbook sourceWorkbook = null;
    sourceWorkbook = application.Workbooks.Add();
    if (sourceWorkbook.Worksheets.Count == 3)
    IWorksheet sheet = sourceWorkbook.Worksheets[0];
    if (image != null)
        IPictureShape pic = sheet.Pictures.AddPicture(1, 1, image); // image is Bitmap
    sourceWorkbook.Version = ExcelVersion.Excel2007;


Here's the Error Message

System.ArgumentNullException: Value cannot be null.
Parameter name: encoder
   Location: System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
   Location: Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.SaveImage(Image image, ImageFormat imageFormat, String proposedPath)
   Location: Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.SaveImage(Image image, String proposedPath)
   Location: Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.SerializeBSE(MsofbtBSE bse)
   Location: Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.SaveWorkbookImages()
   Location: Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.SaveWorkbook(ExcelSaveType saveAsType)
   Location: Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.SaveDocument(ExcelSaveType saveType)
   Location: Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.SaveDocument(Stream stream, ExcelSaveType saveType)
   Location: Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.SaveDocument(String filename, ExcelSaveType saveType)
   Location: Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.Serialize(String fullName, WorkbookImpl book, ExcelSaveType saveType)
   Location: Syncfusion.XlsIO.Implementation.WorkbookImpl.SaveAs(String FileName, ExcelSaveType saveType, ExcelVersion version)
   Location: Syncfusion.XlsIO.Implementation.WorkbookImpl.SaveAs(String FileName)

1 Reply

RA Rajesh A Syncfusion Team March 1, 2013 12:45 PM UTC

Hi Dong-Rak Park,

  Thank you using the Syncfusion Product.

We are not able to reproduce the issue from our side and we suspect that issue may be raised due to the image. So, Could you please update the sample or image with your version details?  Its help us to investigate further on this.

Please let us know if you have any clarification.


Rajesh A

Live Chat Icon For mobile
Up arrow icon