Solved

C# Crystal Reports

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

627 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