export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel
Go Back  Xtreme Visual Basic Talk > > > export aspx page with Report Viewer controls to excel


Reply
 
Thread Tools Display Modes
  #1  
Old 08-15-2011, 03:50 PM
bpgadhia bpgadhia is offline
Newcomer
 
Join Date: Aug 2011
Posts: 1
Default export aspx page with Report Viewer controls to excel


Hi,

I am using following code to export an aspx page with one report viewer control to excel 2010.

Dim warnings As Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim bytes As Byte()

FilePath = "d:\Share\DashBoard.xls"

Dim fs As New FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.Write)
bytes = PrintReportViewer.ServerReport.Render("Excel", Nothing, mimeType, encoding, extension, streamids, warnings)

length = fs.Length
If (length > 0) Then
'file pointer set to the end of file
fs.Seek(0, SeekOrigin.End)
Else
'file pointer set to the beginning of file
fs.Seek(0, SeekOrigin.Begin)
End If

fs.Write(bytes, 0, bytes.Length)
'fs.Flush()
fs.Close()

Here PrintReportViewer is a Report viewere control on aspx page which displays MSReporting Service's report.
This works fine. Output file has 25kb data. I am able to export and view in Excel 2010.

Now I want to export a page with two or more report viewer controls and reports on it. I am now adding following code to above code

fs = New FileStream(FilePath, FileMode.Append)
bytes = PrintReportViewer1.ServerReport.Render("Excel", Nothing, mimeType, encoding, extension, streamids, warnings)
length = fs.Length
If (length > 0) Then
'file pointer set to the end of file
fs.Seek(0, SeekOrigin.End)
Else
'file pointer set to the beginning of file
fs.Seek(0, SeekOrigin.Begin)
End If
fs.Write(bytes, 0, bytes.Length)
fs.Flush()
fs.Close()

where PrintReportViewer1 is another report viewer control.
After I run this code I see that output file has more data(50 kb) but when I try to see in excel it shows only one report. The first one.

Am I doing something wrong? Can anyone please suggest what needs to be done.
Thanks in adavance.
Bharat.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel
 
export aspx page with Report Viewer controls to excel
export aspx page with Report Viewer controls to excel
 
-->