Link to home
Start Free TrialLog in
Avatar of Jamil Muammar
Jamil Muammar

asked on

ASP.NET C# export very large array to excel

Hi,

 I'm using the follwoing code to export large array to Excel file, unfortunately I'm getting the attached error message.

also attached the Code.

How do I fix my code to export the large data to Excel file  

Thanks
Code.jpg
Error-Message.jpg
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

In your statement, return File ..., is File a method that you created and if yes please post that method or if it is one provided by .Net please give the full name starting with the namespace. Thanks.
Avatar of Jamil Muammar
Jamil Muammar

ASKER

Hello ,

protected internal FilePathResult File(string fileName, string contentType);

         //Summary:
        //     Creates a System.Web.Mvc.FileContentResult object by using the file contents,
        //     content type, and the destination file name.
        //
        // Parameters:
        //   fileContents:
        //     The binary content to send to the response.
        //
        //   contentType:
        //     The content type (MIME type).
        //
        //   fileDownloadName:
        //     The file name to use in the file-download dialog box that is displayed in
        //     the browser.
        //
        // Returns:
        //     The file-content result object.
Hi Jamil;

In your last post all you posted was the function signature for a function called File which takes two parameters and some comments. If you look at the image below the File function has four parameters so not the correct function that you posted and I am looking for ALL the code in that function so that I can determine why you can not use another larger array.   User generated image
Hi,
here is the Function, it contain 3 parameters not 4.

protected internal virtual FileContentResult File(byte[] fileContents, string contentType, string fileDownloadName);
        //
        // Summary:
        //     Creates a System.Web.Mvc.FileStreamResult object using the System.IO.Stream
        //     object, the content type, and the target file name.
        //
        // Parameters:
        //   fileStream:
        //     The stream to send to the response.
        //
        //   contentType:
        //     The content type (MIME type)
        //
        //   fileDownloadName:
        //     The file name to use in the file-download dialog box that is displayed in
        //     the browser.
        //
        // Returns:
        //     The file-stream result object.

Thanks in advanced
Where is the CODE?
It's Provided by .NET
I am unable to find any info on the DeviceManagementAPI method or ExportBackup method so can not verify what type of stream it is returning. I would suggest that you place a breakpoint on the line, stream.Close();, and verify what the variable data contains in it, bytes are integer values between 0 and 255, if it contains other values then that it is an issue?
I'm using NPOI.dll, it support Excel 2003 which is limited to 65000 rows

How Do I update or download a new NOPI.dll which is support Excel 2010 ?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial