Click here to Skip to main content
14,932,737 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi All,

I am using rdlc in my window application. I am using 2 Table Adapter with parameter as datasource and custom paging 8 X 5.5 in rdlc. I want to print rdlc report without viewing it. I have gone through the following link:

http://msdn.microsoft.com/en-us/library/ms252091(v=VS.80).aspx[^]

But, it is not best for my application.

I want efficient as well as easy code or method to print it.

Regards!
Aman
Posted
Updated 22-Apr-11 21:05pm
v2
Comments
Sandeep Mewara 23-Apr-11 1:22am
   
Your question sounds more of qualitative type then an issue of some sort. What kind of response you are expecting here?
Aman4.net 23-Apr-11 2:55am
   
My point was that Why do I export report into images and Print them one by one. However, we could do it without wasting our system resoucres to do all these things. I have done it with following way. Please comment on that.

1 solution

Hi All,

I just tried the following concept to print without viewing report.
DialogResult ans = MessageBox.Show("Want Print Preview?", "App Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans == DialogResult.No)
{
Int32 OrderID = Convert.ToInt32(dgvOrders.SelectedRows[0].Cells["OrdID"].Value);
//Create a ReportViewer Control.
ReportViewer _reportviewer = new ReportViewer();
LocalReport _localReport = _reportviewer.LocalReport;
//Set the LocalReport properties for the report datasource and resource
_localReport.ReportPath = AppDomain.CurrentDomain.BaseDirectory + "..\\..\\Jobs\\PrintOrder.rdlc";
//_localReport.ReportPath = AppDomain.CurrentDomain.BaseDirectory + "Jobs\\PrintOrder.rdlc";
this.tblOrderItemsTableAdapter.Fill(this.billDataSet.tblOrderItems, OrderID);
this.tblOrderTableAdapter.Fill(this.billDataSet.tblOrder, OrderID);
ReportDataSource _reportDataSource1 = new ReportDataSource();
_reportDataSource1.Name = "BillDataSet_tblOrder";
_reportDataSource1.Value = this.billDataSet.tblOrder;
ReportDataSource _reportDataSource2 = new ReportDataSource();
_reportDataSource2.Name = "BillDataSet_tblOrderItems";
_reportDataSource2.Value = this.billDataSet.tblOrderItems;
_localReport.DataSources.Add(_reportDataSource1);
_localReport.DataSources.Add(_reportDataSource2);
_reportviewer.RenderingComplete += new RenderingCompleteEventHandler(_reportviewer_RenderingComplete);
_reportviewer.RefreshReport();
}
else
{
FormPrntOrd _Order = new FormPrntOrd(Convert.ToInt32(dgvOrders.SelectedRows[0].Cells[0].Value));
_Order.ShowDialog(this);
}

We can call _reportviewer.Print() or _reportviewer.PrintDialog() in _reportviewer_RenderingComplete. The _reportviewer should be declare in partial class.
   
v2
Comments
sh_mary1 19-Jul-12 10:21am
   
I check this code but i get error in (RenderingCompleteEventHandler(_reportviewer_RenderingComplete);) line please what this error
anbumania 23-Oct-13 7:32am
   
I want to print through rdlc method without using print preview c#.net wpf ...anybody know tell me....

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