Crystal Report code on WinForms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Eleven
    New Member
    • Mar 2008
    • 19

    Crystal Report code on WinForms

    I've got a web page that I use to generate Crystal Reports, it works perfectly but now I want to do it in WinForms. I need you guys to help me out on the exporting to PDF, the ExportToHttpRes ponse won't work on WinForms...

    Code:
    private void btnCK2_Click(object sender, EventArgs e)
            {
                ReportDocument doc = new ReportDocument();
                doc.Load("...\RPT\CK2.rpt");
                doc.SetParameterValue("ent_no", txtEntNo.Text);
                doc.SetParameterValue("trak_no", txtTrackNo.Text);
                doc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Certificate");
            }
    I tried the following but nothing happens when I click on my button.
    Code:
    doc.ExportToDisk(ExportFormatType.PortableDocFormat, "Report");
    I'd really appreciate your help, thanks!
  • vekipeki
    Recognized Expert New Member
    • Nov 2007
    • 229

    #2
    I know that there is also a bunch of options that you can set like:

    Code:
    doc.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
    doc.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
    doc.ExportOptions.DestinationOptions.DiskFileName = "filename.pdf";
    but I don't have Crystal reports installed right now so I don't remember it exactly, try to find an example for ExportOptions class in your help docs to see how it works.

    Comment

    • Eleven
      New Member
      • Mar 2008
      • 19

      #3
      Thanks a lot, I got it to work!

      Comment

      Working...