Dynamically exporting the report to HTML
Hi there..
I am generating reports and have some problem while dynamically selecting the report source while exporting it to HTML. my application goes like this and i have explained the problem at the end. I would greatly appreciate if anyone can help me out...
1. in the application, users will select the report from the combo box
2. based on the value, appropriate dataset will be generated and that will be binded to the report source of the crystal report viewer
3. the export button should export the report thats in the report source..i wrote a code to export to html and that also works fine
4. the problem is while exporting i should be able to get dynamically the binded source of the viewer control and pass it to a generic ExportToHtml method.
code explanation:
report declarations at the start of the code
crSales_Report mcrSales_Report;
crMark_Report mcrMark_Report;
on button click event i am calling this method based on the type of report that he selected initially
ExportToHTML(mcrSales_Report, folderName, fileName);
ExportToHTML (mcrMark_Report, folderName, fileName);
method declaration:
ExportToHTML (crSales_Report myReport, string folderName, string fileName)
{
//basic code for html format option and destination options
myReport.Export()
}
the problem is in the method declarataion, right now i am hard coding it as crSales_Report class, but that should be dynamic...
i have also tried this
crystalreportviewer.ReportSource.GetType() - it returns the value of the class (crSales_Report), but i donno how to use this....can anyone help me out??
Thx--sara
|