I have a crystal report (quote)that is created based on a range of values used as crystal report parameters. I would like to have code to be able to generate an individual pdf file for each quote generated.
Im not very experienced at this. I have never called the crystal report from code attached to anything like a button. I have only run it by using crystal reports viewer. Can you give me some insite.
the base class for crystal reports is ReportDocument. There are 2 ways to load reports.
1.
Code:
var doc = new ReportDocument();
doc.Load("path to report");
2.
Code:
var doc = new MyReport(); //which inherits ReportDocument
where MyReport is the name of a report within the solution(MyReport.rpt). VS IDE will auto-generate a MyReport.cs file.
now you have programmatic control of the report. There a few options for exporting the file
ExportToStream, ExportToDisk, ExportToHttp, or simply Export(with defined options). You can also control some of the print options. I'm not sure if/how the print options would effect the export options.
Documentation on CR for .net is limited at best. I also find the API is very limited. almost an after thought to incorporating crystal with .net.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.