473,394 Members | 1,960 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,394 software developers and data experts.

PDF export

Hi all,

I am posting this question again, because I know that most readers only read
the new messages. I have been suffering with this problem for weeks now. I
tried several
newsgroups, but nobody can tell me how to solve this problem. And as it
seems, it will happen to me again in this newsgroup.
The problem: I have a webform that shows a Crystal Report. In the page_init
I export the
report to a pdf. When I hit the printbutton, the PDF shows. When I close the
form, the PDF is deleted from the server. So far, so good.

This works for all reports, exept for reports with parameters. The Crystal
Report shows in the browser, but the report is not exported to a pdf, with
the error that it is missing parameters. So, what I think is the case, is
that the parameters are forwarded to the viewer but not to the report
object. Can anybody help me out with this one?

I thought it would be something like this
myReport.DataDefinition.ParameterFields.Item("Peri ode").Value = ???

There is an extra catch in this, I am not using a discrete parameter but a
range parameter.
I have put the code here. The parameters are hardcoded in this case.

Please help!
Kind regards,
Alison.

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
Dim myDiskFileDestinationOptions As
CrystalDecisions.Shared.DiskFileDestinationOptions
Dim myParameterFieldDefinitions As ParameterFieldDefinitions
Dim myParameterFieldDefinition As ParameterFieldDefinition
Dim myExportFile As String
Dim myReport As New test

Dim myParameterFields As New ParameterFields
Dim myParameterField As New ParameterField
Dim myRangeValues As New ParameterRangeValue
Dim myRangeValue As New ParameterRangeValue
myParameterField.ParameterFieldName = "Periode"
myRangeValue.StartValue = 200409
myRangeValue.EndValue = 200510
myParameterField.CurrentValues.Add(myRangeValue)

myParameterFields.Add(myParameterField)
crvTest.ParameterFieldInfo = myParameterFields

myExportFile = "\\192.168.2.106\syn2sql$\PDF_" &
Session.SessionID.ToString & ".pdf"
myDiskFileDestinationOptions = New
CrystalDecisions.Shared.DiskFileDestinationOptions
myDiskFileDestinationOptions.DiskFileName = myExportFile
myExportOptions = myReport.ExportOptions
With myExportOptions
.DestinationOptions = myDiskFileDestinationOptions
.ExportDestinationType = .ExportDestinationType.DiskFile
.ExportFormatType = .ExportFormatType.PortableDocFormat

End With

Try
myReport.Export()
Catch err As Exception
Response.Write("<BR>")
Response.Write(err.Message.ToString)
End Try

Session("exportbestand") = myExportFile
crvTest.ReportSource = myReport

End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Dim myExportFile As String = CType(Session.Item("exportbestand"),
String)
Response.WriteFile(myExportFile)
Response.Flush()
Response.Close()

System.IO.File.Delete(myExportFile)
End Sub

Nov 23 '05 #1
1 1082
Come on people!
Why only give answers to the simple questions!


"Alison Givens" <in**@cross-it.nl> wrote in message
news:OT**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I am posting this question again, because I know that most readers only
read the new messages. I have been suffering with this problem for weeks
now. I tried several
newsgroups, but nobody can tell me how to solve this problem. And as it
seems, it will happen to me again in this newsgroup.
The problem: I have a webform that shows a Crystal Report. In the
page_init I export the
report to a pdf. When I hit the printbutton, the PDF shows. When I close
the
form, the PDF is deleted from the server. So far, so good.

This works for all reports, exept for reports with parameters. The Crystal
Report shows in the browser, but the report is not exported to a pdf, with
the error that it is missing parameters. So, what I think is the case, is
that the parameters are forwarded to the viewer but not to the report
object. Can anybody help me out with this one?

I thought it would be something like this
myReport.DataDefinition.ParameterFields.Item("Peri ode").Value = ???

There is an extra catch in this, I am not using a discrete parameter but a
range parameter.
I have put the code here. The parameters are hardcoded in this case.

Please help!
Kind regards,
Alison.

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
Dim myDiskFileDestinationOptions As
CrystalDecisions.Shared.DiskFileDestinationOptions
Dim myParameterFieldDefinitions As ParameterFieldDefinitions
Dim myParameterFieldDefinition As ParameterFieldDefinition
Dim myExportFile As String
Dim myReport As New test

Dim myParameterFields As New ParameterFields
Dim myParameterField As New ParameterField
Dim myRangeValues As New ParameterRangeValue
Dim myRangeValue As New ParameterRangeValue
myParameterField.ParameterFieldName = "Periode"
myRangeValue.StartValue = 200409
myRangeValue.EndValue = 200510
myParameterField.CurrentValues.Add(myRangeValue)

myParameterFields.Add(myParameterField)
crvTest.ParameterFieldInfo = myParameterFields

myExportFile = "\\192.168.2.106\syn2sql$\PDF_" &
Session.SessionID.ToString & ".pdf"
myDiskFileDestinationOptions = New
CrystalDecisions.Shared.DiskFileDestinationOptions
myDiskFileDestinationOptions.DiskFileName = myExportFile
myExportOptions = myReport.ExportOptions
With myExportOptions
.DestinationOptions = myDiskFileDestinationOptions
.ExportDestinationType = .ExportDestinationType.DiskFile
.ExportFormatType = .ExportFormatType.PortableDocFormat

End With

Try
myReport.Export()
Catch err As Exception
Response.Write("<BR>")
Response.Write(err.Message.ToString)
End Try

Session("exportbestand") = myExportFile
crvTest.ReportSource = myReport

End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Dim myExportFile As String = CType(Session.Item("exportbestand"),
String)
Response.WriteFile(myExportFile)
Response.Flush()
Response.Close()

System.IO.File.Delete(myExportFile)
End Sub

Nov 23 '05 #2

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

Similar topics

13
by: DarkSpy | last post by:
many c++ compilers including "gcc" have not implemented the "export" keyword, but the comeau compilers made it (just i knew). i want to know about: is it too difficult to implement "export"...
205
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
1
by: Do Park via SQLMonster.com | last post by:
Hello all, I don?t often export data from a table. I am wondering how you export data from a table. I?d like to know how you export in real world. Do you export data from a table to a flat...
6
by: maricel | last post by:
Is there anybody out there who have any idea why EXPORT is relatively slower when putting the output file on a network drive - map drive from onother PC compared to putting it on my local PC drive...
5
by: David | last post by:
I am a little confused by DB2 Backup and Export. I used "db2 backup db QAS to /dev/rmt0" backuping 650GB database to a IBM LTO 3581 (1 drive) only 11 hours. But I used "db2 export to /dev/rmt0...
5
by: Tim Eliot | last post by:
Just wondering if anyone has hit the following issue and how you might have sorted it out. I am using the command: DoCmd.TransferText acExportMerge, , stDataSource, stFileName, True after...
7
by: Pat | last post by:
I would like to send the Print Preview of a MS Access form to a Snapshot file. The form contains an OLE graph. BACKGROUND A snapshot of a report is possible. If I could I would use a report to...
1
by: chaitu | last post by:
Hi, Can anybody tell me what the error code for Export is. Like i get the message SQL3104N The Export utility is beginning to export data to file...
5
by: JHNielson | last post by:
I have a somewhat simple question, but have been baffled by it for a while, and now I'm on a tight deadline - have to get it done within 24 hours. I am trying to export a set of files to my hard...
8
by: iheartvba | last post by:
Hi I am using Access 2007 and am trying to export a query to a fixed length text file. I tried using the following code to export the text file: DoCmd.TransferText acExportFixed, , "qryFFRDeFile",...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...
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...

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.