workbook.Save in dotnet 3.5 asp.net project produces error

Last post 09-21-2008, 10:03 PM by simon.zhao. 1 replies.
Sort Posts: Previous Next
  •  09-21-2008, 11:38 AM 144871

    workbook.Save in dotnet 3.5 asp.net project produces error

    In a visual studio 2008, dotnet 3.5 asp.net project I have the following code:

    Dim workbook As Workbook = New Workbook()
    Dim sheet As Worksheet = workbook.Worksheets(0)
    Dim dtAll As Data.DataTable = getDateTable()
    sheet.Cells.ImportDataTable(dtAll, True, 0, 0, dtAll.Rows.Count, dtAll.Columns.Count, False, "dd-mm-yyyy")
    sheet.AutoFitColumns()
    workbook.Save("List.xls", FileFormatType.Default, SaveType.OpenInBrowser, Me.Response)

    When run (regardles of what FileFormatType and SaveType I set in workbook.Save) the following  javascript error (in prompt) is produced:

    A Runtime Error has occurred.
    Do you wish to Debug?
    Line: 5252
    Error: System error: -1072896748.

    Debugging opens the following function "Sys$Net$XMLHttpExecutor$get_responseData()" in the file:

    // Name:        MicrosoftAjax.debug.js
    // Assembly:    System.Web.Extensions
    // Version:     3.5.0.0
    // FileVersion: 3.5.21022.8
    //!-----------------------------------------------------------------------
    //! Copyright (C) Microsoft Corporation. All rights reserved.
    //!-----------------------------------------------------------------------
    //! MicrosoftAjax.js
    //! Microsoft AJAX Framework.

    // JavaScript Extensions and Type System

    ...

    function "Sys$Net$XMLHttpExecutor$get_responseData()" at line lines 5242 - 5253:

    function Sys$Net$XMLHttpExecutor$get_responseData() {
    /// <value type="String" locid="P:J#Sys.Net.XMLHttpExecutor.responseData"></value>
    if (arguments.length !== 0) throw Error.parameterCount();
    if (!this._responseAvailable) {
    throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_responseData'));
    }
    if (!this._xmlHttpRequest) {
    throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_responseData'));
    }
    return this._xmlHttpRequest.responseText;
    }

    What am I doing wrong?

    I can't find any forum threads or knowledge articles that help (may not be looking the right places).

     
  •  09-21-2008, 10:03 PM 144892 in reply to 144871

    Re: workbook.Save in dotnet 3.5 asp.net project produces error

    Hi,

    Could you ingore all codes about Aspose.Cells and only open the file with FileStream and write it to response? See following codes:

     FileStream fs = File.Open(@"F:\FileTemp\book1.xls");
            byte[] buffer = new byte[fs.Length];
            fs.Read(buffer, 0, buffer.Length);
            Response.OutputStream.Write(buffer, 0, buffer.Length);

    And we will check this issue on VS2008 with AJAX.


    Simon Zhao
    Developer
    Aspose Nanjing Team
    Contact Us
     
View as RSS news feed in XML