Solved

ASP.NET C# export very large array to excel

Posted on 2016-09-04
9
135 Views
Last Modified: 2016-09-20
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
0
Comment
Question by:Jamil Muammar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 41783652
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.
0
 

Author Comment

by:Jamil Muammar
ID: 41783661
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.
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 41783667
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
0
Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

 

Author Comment

by:Jamil Muammar
ID: 41783670
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
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 41783671
Where is the CODE?
0
 

Author Comment

by:Jamil Muammar
ID: 41783675
It's Provided by .NET
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 41783716
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?
0
 

Author Comment

by:Jamil Muammar
ID: 41784319
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
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 41784604
Have you done this, "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?"?
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question