Solved

C# Crystal Reports

Posted on 2004-04-15
6
239 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
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

772 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