473,473 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Response.Write fails to provide client with large Excel report

2 New Member
I am new to the whole issue of generating/sending Excel report in ASP.net. Code below sometimes does not work for large amount of data (large Excel report). Client has IE9 and MS Office 2010. Client does not get any errors, client simply does not get report after long wait time. Are there any alternative to the approach below, for providing client with large Excel report ? Anything done wrong in the code below that may cause the problem. All replies are appreciated.
Expand|Select|Wrap|Line Numbers
  1. Response.ContentType = "application/ms-excel"
  2. Response.AddHeader("Content-Disposition", "attachment; filename=" + ReportName + ".xls")
  3.  
  4. Response.Write("<table border =1>")
  5. For Each ch As ColumnHeaders In arrCh
  6.     If ch.ColumnName <> "" Then
  7.             pCh = pCh & "<td><b>" & ch.ColumnName & "</b></td>"
  8.                     pColCount = pColCount + 1
  9.                 End If
  10. Next
  11.  
  12. If pExtraHeader <> "" Then
  13.     Response.Write(pExtraHeader)
  14. End If
  15. Response.Write("<tr>" & pCh & "</tr>")
  16. If oSQLDataReader.HasRows Then
  17.     Do While oSQLDataReader.Read()
  18.             Response.Write("<tr>")
  19.                 For I = 0 To arrCh.Count - 1
  20.                     If arrCh(I + 1).columnname <> "" Then
  21.                         Response.Write("<td>" & strColumnValue & "</td>")
  22.                         If arrCh.Item(I + 1).isTotal = True Then
  23.                             arrCh.Item(I + 1).placeholder = CDbl(arrCh.Item(I + 1).placeholder) + CDbl(oSQLDataReader.GetValue(I))
  24.                         End If
  25.                      End If
  26.                 Next
  27.                 Response.Write("</tr>")
  28.         Loop
  29.  
  30.         Dim pTotal As String = ""
  31.         For Each ch As ColumnHeaders In arrCh
  32.             If ch.ColumnName <> "" Then
  33.               pTotal = pTotal & "<td><b>" & strColumnValue & "</b></td>"
  34.           End If
  35.         Next
  36.     Response.Write("<tr>" & pTotal & "</tr>"
  37.  
  38. End If
  39. Response.Write("</table>")
Feb 5 '13 #1
3 2081
Rabbit
12,516 Recognized Expert Moderator MVP
It works with small reports though? And how big are we talking?
Feb 5 '13 #2
hksl
2 New Member
I have no direct contact with client, but I was told 6 MB. Though when I retrieve same report connecting from my system, get ope or save prompt, and save, xls file size is 281 KB. Assumption is that size of HTML sent bt Response.Write is too big. I am trying to find way to decrease size of HTML that is sent using Response.Write or should I use something else instead of Response.Write?
Feb 5 '13 #3
Frinavale
9,735 Recognized Expert Moderator Expert
Have you considered binding the data source to a GridView?
Or using a Repeater to display the data?

You could consider implementing pagination in your GridView or Repeater to reduce the amount of data being rendered at a given time.

-Frinny
Feb 7 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Steven Blair | last post by:
Hi, I am using C# and IIS for a application. I receive a request message, process it then send a response back to my client. The problem I have, when I call Response.Write the message sent to my...
0
by: Raghavendra | last post by:
hi, we r using forms authetication. problem :- i am using the below code to generate excel report but since we r using forms authetication.. after generating excel report the browser directs...
11
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as...
5
by: Terry | last post by:
I am building an ASP.net application which will generate a formatted Excel report. Is there a way I can using the Excel on the client pc? Do I have to do a full install of Excel on the server or...
5
by: ken | last post by:
how ASP.NET to generate excel report(office 2003) to client what component i need to reference into the asp.net application and what component i need to install to the server? Moreover, does it...
2
by: John Walker | last post by:
Hello, Below is my code for exporting a datagrid to Excel. It works fine, but we're going to need to somehow have a report header, user input parameters and system date display at the top of the...
1
by: shankumar | last post by:
Hai Evrybody, I have one problem, that is i design a ASP report getting data from MS SQL Server 2000 and displays it as a desinged format and also "one option to export this same format to MS...
4
by: cbtechlists | last post by:
I have an ASP app that we've moved from a Windows 2000 to a Windows 2003 server (sql server 2000 to sql server 2005). The job runs fine on the old servers. Part of the app takes a recordset and...
1
by: chandhseke | last post by:
Hi folks, I am a newbie to this functionality of creating excel report using VB/VB Script. I have been given a code and asked to add filters to the excel sheet that is created using the below...
1
by: chandhseke | last post by:
Hi, I have requirement to pre-populate currency symbols in excel report generated using ASP. Please review the code below and help in fixing this. <%@ Language=VBScript %> <% Response.Buffer...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.