Solved

C# Crystal Reports

Posted on 2004-04-15
6
253 Views
Last Modified: 2008-02-01
hi,

can anyone please help me, i am trying to populate a crystal report with the result of a stored procedure.  when i have tried applying the dataset to the report i am returned with a blank report, i am lost on how to do this and would be very grateful for any solutions, thanks
0
Comment
Question by:joeyton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 125 total points
ID: 10837928
remember to set the table on the .Fill() to the same table name you used in the report.
0
 
LVL 1

Author Comment

by:joeyton
ID: 10841072
Ok, It seems to work, thanks.

but when the report opens it expands the table it is placed in.  Can I set a size for the report to be so it will fit into the area of the page that I want it to take up.

i.e. the width be no more than 500
0
 
LVL 1

Author Comment

by:joeyton
ID: 10841163
would anyone know how to open the report directly into a pdf?
0
 
LVL 9

Expert Comment

by:malharone
ID: 10845356
this example shows how you can export to PDF

once it's exported, then you can use System.Diagnostic.Process.Start("YOUR_PDF_FILE_PATH") to open this file using a pdf viewer.

- hope this helps


                Dim exportPath As String = Me.txtPath.Text
                If Not (exportPath Is Nothing OrElse exportPath.Length < 1) Then

                    Dim crDiskFileDestinationOptions As New DiskFileDestinationOptions()
                    Dim crExportOptions As CrystalDecisions.Shared.ExportOptions = rpt1.ExportOptions

                    rpt1.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
                    rpt1.ExportOptions.DestinationOptions = crDiskFileDestinationOptions
                    crDiskFileDestinationOptions.DiskFileName = exportPath

                    Select Case combobox.selectedIndex
                        Case 4
                            rpt1.ExportOptions.ExportFormatType = ExportFormatType.RichText
                        Case 2
                            rpt1.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat
                        Case 5
                            rpt1.ExportOptions.ExportFormatType = ExportFormatType.WordForWindows
                        Case 1
                            rpt1.ExportOptions.ExportFormatType = ExportFormatType.Excel
                        Case 6
                            rpt1.ExportOptions.ExportFormatType = ExportFormatType.CrystalReport
                        Case 3
                            Dim HTML40Formatopts As New HTMLFormatOptions()
                            With crExportOptions
                                .ExportDestinationType = ExportDestinationType.DiskFile
                                .ExportFormatType = ExportFormatType.HTML40
                            End With

                            With HTML40Formatopts
                                .HTMLBaseFolderName = New System.IO.FileInfo(exportPath).DirectoryName   ' Foldername to place HTML files
                                .HTMLFileName = "Transaction Tracking System Report"
                                .HTMLEnableSeparatedPages = True
                                .HTMLHasPageNavigator = True
                            End With
                            crExportOptions.FormatOptions = HTML40Formatopts
                    End Select
                    Try
                        rpt1.Export()
                        MessageBox.Show("The export file(s) were successfully generated at the following location: " & vbCrLf & "Export Path: " & exportPath, "Completed Export", MessageBoxButtons.OK, MessageBoxIcon.Information)
                    Catch ex As Exception
                        MessageBox.Show("The following error occured while creating the specified report: " & vbCrLf & ex.Message & vbCrLf & "Export Path: " & exportPath, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    End Try
                Else
                    MessageBox.Show("You must provide a valid file name / path.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                End If
0

Featured Post

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question