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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Exporting to Excel 2007

Thread ID:

Created:

Updated:

Platform:

Replies:

107309 Feb 25,2013 05:26 AM UTC Mar 1,2013 12:45 PM UTC WinForms 1
loading
Tags: XlsIO
Dong-Rak Park
Asked On February 25, 2013 05:26 AM UTC

Hi,

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)
    {
sourceWorkbook.Worksheets[2].Remove();
        sourceWorkbook.Worksheets[1].Remove();
    }
 
    IWorksheet sheet = sourceWorkbook.Worksheets[0];
    if (image != null)
    {
        IPictureShape pic = sheet.Pictures.AddPicture(1, 1, image); // image is Bitmap
    }
 
    sourceWorkbook.Version = ExcelVersion.Excel2007;
    sourceWorkbook.SaveAs(xlsFileName);
    sourceWorkbook.Close();
    excelEngine.Dispose();

--------------------------------------------------------------------------------


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)




Rajesh A [Syncfusion]
Replied On 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.

Thanks,

Rajesh A


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;