on 09-12-2011 11:41 AM
I'm using CR 13.0.1 and CR4VS2010 on a C#.net website.
I've setup CR on my pc and have reports running fine and dispalying correctly in the web viewer. My problem lies when trying to either print or export the report. The report shows all the formatting and data in the viewer but when i click print or export it seems to lose the data. The various images and text fields are printed/exported but any of the data fields are not printed at all.
protected void Page_Load(object sender, EventArgs e)
{
//Create Report Object and load the relevant report file
ReportDocument crReportDoc = new ReportDocument();
crReportDoc.Load(HttpContext.Current.Server.MapPath("invoice.rpt"));
//Set the database connection details, so the user doesn't require them
crReportDoc.SetDatabaseLogon("username", "password");
//Setup any/all parameters for the report
crReportDoc.SetParameterValue("@dealerID", CMS.CMSHelper.CMSContext.CurrentUser.GetValue("DealerID"));
crReportDoc.SetParameterValue("@dateFrom", Request.QueryString["dateFrom"]);
crReportDoc.SetParameterValue("@dateTo", Request.QueryString["dateTo"]);
//configure reportdocument
crReportDoc.ReportOptions.EnableSaveDataWithReport = true;
//Configure the reportviewer
CrystalReportViewer1.HasCrystalLogo = false;
CrystalReportViewer1.HasPrintButton = true;
CrystalReportViewer1.PrintMode = PrintMode.Pdf;
CrystalReportViewer1.HasExportButton = true;
CrystalReportViewer1.HasDrillUpButton = false;
CrystalReportViewer1.HasToggleGroupTreeButton = false;
CrystalReportViewer1.HasToggleParameterPanelButton = false;
CrystalReportViewer1.ToolPanelView = ToolPanelViewType.None;
CrystalReportViewer1.AutoDataBind = true;
CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;
//Tie the reportdocument to the viewer object
CrystalReportViewer1.ReportSource = crReportDoc;
}
For the dealerID parameter the CMS.CMSHelper.etc bit is part of the CMS system the website is built with (kentico).
Can anyone suggest something that I have not done here that would explain why the report appears correctly on screen (through the webviewer) but fails to include any data when its printed or exported
Can't explain it, but here are a few tests;
1) Try to print a saved data report
2) Try to print a report that is not using parameters
3) Try a different printer driver as "default"
4) Enable the option "Dissociate Formatting Page Size and Printer Paper Size" on the report
5) What format do you export to?
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've got it working now.
The code above wasnt saving the reportdocument to the session so presumably not picking up anything when trying to print. Added in some code to save to the session/restore from the session on a postback and its now working fine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.