Sign UpSign Up   Sign InSign In Welcome Guest,
Live Chat Live Chat

Saving Workbook as csv gives ObjectDisposedException

Last post 07-02-2009, 2:16 AM by ETTU. 2 replies.
Sort Posts: Previous Next
  •  07-01-2009, 9:44 AM 186408

    Saving Workbook as csv gives ObjectDisposedException .NET

    When i try to save a Workbook as CSV in de Response from my asp.net page i get an ObjectDisposedException with the message 'Cannot access a closed Stream. '; saving the Workbook as Excel works as expected. 

    I use this code:
    wb.Save(fileName, FileFormatType.Default, SaveType.OpenInExcel, Response);
    to save the Workbook in Excel.

    I use this code:
    wb.Save(fileName, FileFormatType.CSV, SaveType.OpenInExcel, Response);
    to save the Workbook in CSV.

    I have tried different SaveTypes but they all give the ObjectDisposedException.
     
  •  07-01-2009, 10:29 AM 186415 in reply to 186408

    Re: Saving Workbook as csv gives ObjectDisposedException

    Hi,

    Thank you for considering Aspose.

    Please try the overloaded method for saving the CSV file as mentioned below as per your requirement,

    workbook.Save(fileName,FileFormatType.CSV,SaveType.OpenInExcel,System.Web.HttpContext.Current.Response,System.Text.Encoding.ASCII);

    Thank You & Best Regards,


    Nausherwan Aslam
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  07-02-2009, 2:16 AM 186536 in reply to 186415

    Re: Saving Workbook as csv gives ObjectDisposedException

    This overload works; thanx for the fast response.
     
View as RSS news feed in XML