Solved

ASP.NET C# export very large array to excel

Posted on 2016-09-04
9
67 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
  • 5
  • 4
9 Comments
 
LVL 62

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 62

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
 

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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 62

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 62

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 62

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

930 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now