Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am doing a C# win app.I am not using the print button on the crystal report . I want to print all pages from crystal report.
My problem is that, only the first page is printing.

Any Help!!
Posted

1 solution

 
Share this answer
 
v2
Comments
lilian87 17-Dec-11 10:56am    
I am using the same code. But still its not printing....
:(
thatraja 17-Dec-11 10:57am    
Check your printer settings. Its perfect code by MSDN. I tried that 100s of times.
lilian87 17-Dec-11 11:26am    
I have 2 buttons. One button printing daily report and another monthly.One report is working fine.That report also has 1+ pages.But thats printing.I used the code u said. Problem with another crystal report.In that ,Only the first page is printing..
thatraja 17-Dec-11 11:36am    
Show your code
lilian87 17-Dec-11 11:40am    
paramField.Name = "@ComplaintDate";
parameterdiscvalue1.Value = dateTimePicker1.Value.ToShortDateString();
paramField.CurrentValues.Add(parameterdiscvalue1);
paramfields.Add(paramField);

crystalReportViewer1.ParameterFieldInfo = paramfields;
cryrpt.Load("CrystalReport6.rpt");
CrTables = cryrpt.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
cryrpt.Load("CrystalReport6.rpt");
cryrpt.SetDatabaseLogon();
crystalReportViewer1.ReportSource = cryrpt;

PageMargins margins;
margins = cryrpt.PrintOptions.PageMargins;
margins.bottomMargin = 350;
margins.leftMargin = 350;
margins.rightMargin =350;
margins.topMargin = 350;
cryrpt.PrintOptions.ApplyPageMargins(margins);

cryrpt.PrintToPrinter(1, false, 0, 0);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900