473,748 Members | 10,569 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

exporting crystal report to Excel

Hi everybody,

I have an ASP.NET website where clients can view their monthly billings by
selecting different options. One of the option is the way they want to see
the report i.e. whether they want to see it in PDF or EXCEL etc etc.....
What I am trying to acheive is depending on their choice of format, I want
to send the stream of that particulae selected format to the browser. I have
tried couple od solutions but I couldn't able to get them to work. Following
is one of them.

Following should work but I m getting the following error: "Thread was being
aborted."

----------------------------------------------------------------------------
---------------------------------

Private Sub xlsExport()

Dim oStream As New System.IO.Memor yStream()

oStream = myReport.Export ToStream(Export FormatType.Port ableDocFormat)

Response.Clear( )

Response.Buffer () = True

Response.Conten tType = "applicatio n/pdf"

Try

Response.Binary Write(oStream.T oArray())
<--------------------- error occured after this

Response.End()

Catch err As Exception

Response.Write( "< BR >")

Response.Write( err.Message.ToS tring)

End Try

End Sub

-------------------------------------------------------------------------

Any help or sugestion will be highly appreciated.

Thanks.
Nov 19 '05 #1
2 6928
Hi Mustufa,

You can try following code:

Dim oStream As System.IO.Memor yStream =
myReport.Export ToStream(Export FormatType.Port ableDocFormat)
' No need a New MemoryStream

Response.Clear( )

Response.Buffer () = True

Response.Conten tType = "applicatio n/pdf"

Try

Response.Binary Write(oStream.T oArray())

Catch err As Exception

Response.Write( "< BR >")

Response.Write( err.Message.ToS tring)

End Try

oStream .Close() ' Close stream before end response

Response.End()

If it doesn't work, please let us know.

HTH

Elton Wang
el********@hotm ail.com

Hi everybody,

I have an ASP.NET website where clients can view their monthly billings by
selecting different options. One of the option is the way they want to see
the report i.e. whether they want to see it in PDF or EXCEL etc etc.....
What I am trying to acheive is depending on their choice of format, I want
to send the stream of that particulae selected format to the browser. I have
tried couple od solutions but I couldn't able to get them to work. Following
is one of them.

Following should work but I m getting the following error: "Thread was being
aborted."

----------------------------------------------------------------------------
---------------------------------

Private Sub xlsExport()

Dim oStream As New System.IO.Memor yStream()

oStream = myReport.Export ToStream(Export FormatType.Port ableDocFormat)

Response.Clear( )

Response.Buffer () = True

Response.Conten tType = "applicatio n/pdf"

Try

Response.Binary Write(oStream.T oArray())
<--------------------- error occured after this

Response.End()

Catch err As Exception

Response.Write( "< BR >")

Response.Write( err.Message.ToS tring)

End Try

End Sub

-------------------------------------------------------------------------

Any help or sugestion will be highly appreciated.

Thanks.

Nov 19 '05 #2
Thanks a lot. It worked!! But now I should tell you that it doesn't work
when I export it to Excel or some other MS office format like MsWord format.
So to export to excel, I did two changes: one is ExportFormatTyp e.Excel AND
the other is Response.Conten tType = "applicatio n/vnd.ms-excel". Apparently
it should work. But what happening is the excel application opens in the
browser but showing no report just saying : "You are curently not logged in.
Please Log in first!". This is kind of weird to me because this message only
comes when somebody tries to access my website's any page without Logging
In. So to find out whats going wrong I put a break point at Page_Init
procedure. So I step through each line and just after executing
Response.End() statement I found that the page loads itself and as result of
that it breaks again at Page_Init procedure. But as I am checking at the
begining whether user is logged in or not and apparently when this page gets
executed 2nd time, it doesn't have any session information thus resulting
"You are curently not logged in. Please Log in first!" message but displays
in the excel application opened in the browser. One more thing I also
observed that whenever I clicked to get the report, I always see a small
window appearing for very short period of time at the top left corner with a
progress bar stating "Transferin g...
http://localhost/webreadfile/report.aspx". I really don't know whats causing
this twice execution because it only happens when I try to export cystal
report to some MS Office format such as MS Excel.

I also tried to put trace on and there I also confirmed it that this page is
getting executed twice in case of exporting to Excel format. Exporting to
PDF works perfect.

I would really really appreciate your help.

thanks.

"Elton W" <El****@discuss ions.microsoft. com> wrote in message
news:9B******** *************** ***********@mic rosoft.com...
Hi Mustufa,

You can try following code:

Dim oStream As System.IO.Memor yStream =
myReport.Export ToStream(Export FormatType.Port ableDocFormat)
' No need a New MemoryStream

Response.Clear( )

Response.Buffer () = True

Response.Conten tType = "applicatio n/pdf"

Try

Response.Binary Write(oStream.T oArray())

Catch err As Exception

Response.Write( "< BR >")

Response.Write( err.Message.ToS tring)

End Try

oStream .Close() ' Close stream before end response

Response.End()

If it doesn't work, please let us know.

HTH

Elton Wang
el********@hotm ail.com

Hi everybody,

I have an ASP.NET website where clients can view their monthly billings by selecting different options. One of the option is the way they want to see the report i.e. whether they want to see it in PDF or EXCEL etc etc.....
What I am trying to acheive is depending on their choice of format, I want to send the stream of that particulae selected format to the browser. I have tried couple od solutions but I couldn't able to get them to work. Following is one of them.

Following should work but I m getting the following error: "Thread was being aborted."


--------------------------------------------------------------------------

--
---------------------------------

Private Sub xlsExport()

Dim oStream As New System.IO.Memor yStream()

oStream = myReport.Export ToStream(Export FormatType.Port ableDocFormat)
Response.Clear( )

Response.Buffer () = True

Response.Conten tType = "applicatio n/pdf"

Try

Response.Binary Write(oStream.T oArray())
<--------------------- error occured after this

Response.End()

Catch err As Exception

Response.Write( "< BR >")

Response.Write( err.Message.ToS tring)

End Try

End Sub


-------------------------------------------------------------------------

Any help or sugestion will be highly appreciated.

Thanks.

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3590
by: Ali Eghtebas | last post by:
Hi, I tried this demo application in here (watch for any line breaks in the URL): (http://support.crystaldecisions.com/communityCS/FilesAndUpdates/vbnet_win_a dodotnet.exe.asp When exporting to Excel there is an empty column after each actual column in the excel. Why? Is this a normal behaviour? Is it impossible to get rid of the empty columns when using the export funtion of the report?
0
2008
by: George G. | last post by:
I am exporting a report to an Excel file. Whatever options I use for the formatting the results remain the same. I have set the ExcelTabHasColumnHeadings to true and false without any difference. I have set the ExcelUseConstantColumnWidth to true and thenset the width to different values and have seen no changes. The code I am using is shown below. private void ExportToExcel (CrystalDecisions.CrystalReports.Engine.ReportDocument Report,...
1
3897
by: Lasso | last post by:
Hi all, Im having problem in exporting pdf file from crystal report. Now I already can show the crystal report but error when exporting. this is my code: Dim myReport As USERReport = New USERReport Dim strExportFile As String = Server.MapPath ("../REPORT/") & "Output.pdf" Dim DiskOpts As CrystalDecisions.Shared.DiskFileDestinationOptions = New
1
3166
by: Mustufa Baig | last post by:
I have an ASP.NET website where I am showing off crystal reports to users by exporting them to pdf format. Following is the code: ---------------- 1 Private Sub ExportReport() 2 Dim oStream As System.IO.MemoryStream = 3 myReport.ExportToStream( ExportFormatType.PortableDocFormat) 4 Response.Clear() 5 Response.Buffer() = True
2
3184
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to set this up so as to do it reliably and minimize overhead? There are currently no constraints on the destination table. Assume the user or some configuration specifies the database name, server name, and filename+fullpath. The server is SQL...
0
1302
by: pradeep kumar pc | last post by:
Hi everybody I have a problem when exporting to MS Excel(Office XP) in Crystal Report 8.5 No data is in Excel file. But no problem in MS Office xp and windows xp Pls Let me know how to solve my Problem.
1
1437
by: nothing | last post by:
I am using crystal report 8.5 with ASP.NET and C#. My crystal report 8.5 display only formula field values only. And i want to export it to excel using ASP.NET with c# Plz. hlp me.
3
2512
by: jennwilson | last post by:
Access 2000 - I have developed a database that houses patient information. The patient information must be sent in an excel file to another company department. I know how to export my data to Excel where it ends up in individual cells (Rows/Colums, etc). I would like for the report that I am exporting to Excel to transfer like a pdf. file. and be similar to the report generated in the database. Kind of like a snapshot of the report, is this...
4
5951
by: Sep410 | last post by:
Hi all, I have a report in crystal report when I export it to excel each column will be shown in 2 or 3 merged columns!!! The worst part is that sometimes the header of the column is in the A and B columns but the details of this columns are in B and C in excel sheet!!! I don’t want that and I want to have normal excel sheet with the boarders around each cell what should I do? Here is the example of my exported report in excel:...
0
9548
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9374
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9325
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9249
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3315
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 we have to send another system
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.