473,326 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

ASP.NET Crystal Report Question

The following code is export the Crystal Report to PDF format on the server
side, then display on the client browser.
Question: How can prompt the PDF's "Print" dialog box, when the PDF was open
completed on the browser.
Thank you for help!

Rdgs,
Hero Ngan

************************************************** *********************
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Web.Design

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form"
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim oRpt As New ReportDocument()
Dim crLogOnInfo As New TableLogOnInfo()

Dim ex As New ExportRequestContext()
Dim s As New System.IO.MemoryStream()
Dim exOption As New ExportOptions()

oRpt.Load("C:\Inetpub\wwwroot\homepage\CrystalRepo rt\Report1.rpt")

With crLogOnInfo.ConnectionInfo
.ServerName = "xxx.xxx.xxx.xxx"
.DatabaseName = "db"
.UserID = "xxxxx"
.Password = "xxxxxxx"
End With

Dim ReportDatabase As Database
Dim dbTables As Tables
Dim dbTable As Table

' Creates the Database object
ReportDatabase = oRpt.Database

' Set logon information for each table in the report
dbTables = ReportDatabase.Tables
For Each dbTable In dbTables
dbTable.ApplyLogOnInfo(crLogOnInfo)
Next

exOption.ExportFormatType = ExportFormatType.PortableDocFormat
ex.ExportInfo = exOption

s = oRpt.FormatEngine.ExportToStream(ex)

With HttpContext.Current.Response
.ClearContent()
.ClearHeaders()
.ContentType = "application/pdf"
.AddHeader("Content-Disposition", "inline;
filename=Report1.pdf")
.BinaryWrite(s.ToArray)
.End()
End With

End Sub

End Class
************************************************** *********************


Nov 17 '05 #1
0 870

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

Similar topics

1
by: rAGHU | last post by:
Hi, In my ASP.NET web application project we need to design crystal reports with Crystal Reports version 8.5 enterpraise edition(Please Note:It is not the Crystal Reports that comes with...
1
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal...
1
by: Jason Chan | last post by:
I am beginner on Crystal Report. I want to ask a basic question. How can i display a report in ASP? I search for many web and try the sample from crystal dicussion but no luck, the code does...
4
by: Rick Thiel | last post by:
Hello, I am trying to build a Crystal report VisualStudio.NET for an ASP.NET application. I would like to build a report that doesn't connect to any particular database at design time because I...
6
by: Dr. Indera | last post by:
hello, much to my surprise, the version of crystal that comes with visual studio.net 2003 does not have a report preview window. i found out that i have to build a form in visual basic.net and...
19
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set...
2
by: aldous scotch | last post by:
I designed a Crystal Report .rpt from within Microsoft Development Environment 2003 Version 7.1.3088 (VB .NET IDE). I selected database fields from the left side Field Explorer onto the Details...
0
by: Ray | last post by:
Dear all, I have some questions about the Crystal Report and vb.net 2003. 1. I have installed the crystal report 10 and vs.net 2003. Should I update the crystal report within the vb.net so as to...
1
by: Agnes | last post by:
my company got crystal report license to write the report , but my client didn't got it. in my vb.net application, i will call that report. (it runs very well, in my company) Everytime,I modify...
3
by: firozfasilan | last post by:
I am new to visual basic 2008. In the past I have used vb6 to display an existing crystal report. I would like to accomplish the same with vb.net. However I am not clear on the syntax to display a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.