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
ASP.NETC#.NET ProgrammingMicrosoft Excel

Avatar of undefined
Last Comment
Fernando Soto

8/22/2022 - Mon
Fernando Soto

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.
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.
Fernando Soto

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.   Your code
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Jamil Muammar

ASKER
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
Fernando Soto

Where is the CODE?
Jamil Muammar

ASKER
It's Provided by .NET
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Fernando Soto

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?
Jamil Muammar

ASKER
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
Fernando Soto

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.