Solved

ASP.NET C# export very large array to excel

Posted on 2016-09-04
9
55 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

708 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

18 Experts available now in Live!

Get 1:1 Help Now