By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

Crystal Report code on WinForms

P: 19
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 ExportToHttpResponse won't work on WinForms...

Expand|Select|Wrap|Line Numbers
  1. private void btnCK2_Click(object sender, EventArgs e)
  2.         {
  3.             ReportDocument doc = new ReportDocument();
  4.             doc.Load("...\RPT\CK2.rpt");
  5.             doc.SetParameterValue("ent_no", txtEntNo.Text);
  6.             doc.SetParameterValue("trak_no", txtTrackNo.Text);
  7.             doc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Certificate");
  8.         }
I tried the following but nothing happens when I click on my button.
Expand|Select|Wrap|Line Numbers
  1. doc.ExportToDisk(ExportFormatType.PortableDocFormat, "Report");
I'd really appreciate your help, thanks!
Jan 12 '09 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 229
I know that there is also a bunch of options that you can set like:

Expand|Select|Wrap|Line Numbers
  1. doc.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
  2. doc.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
  3. 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.
Jan 12 '09 #2

P: 19
Thanks a lot, I got it to work!
Jan 13 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.