printing - How to directly print rdlc report without showing PrintDialog() in C#? -
i have application have print rdlc
report without showing printdialog , using default specified printer defined in application. below test implementaion code.
microsoft.reporting.winforms.reportviewer reportviewersales = new microsoft.reporting.winforms.reportviewer(); microsoft.reporting.winforms.reportdatasource reportdatasourcesales = new microsoft.reporting.winforms.reportdatasource(); reportviewersales.reset(); reportviewersales.localreport.reportpath = @"sales.rdlc"; reportdatasourcesales.name = "salestabledataset"; int = 1; foreach (product item in productsaleslist) { dataset.currentsales.addcurrentsalesrow(i, item.name, item.quantity.tostring(), item.price.tostring(), item.price.tostring()); i++; } reportdatasourcesales.value = dataset.currentsales; reportviewersales.localreport.datasources.add(reportdatasourcesales); dataset.endinit(); reportviewersales.refreshreport(); reportviewersales.renderingcomplete += new renderingcompleteeventhandler(printsales);
and here rendering complete method
public void printsales(object sender, renderingcompleteeventargs e) { try { reportviewersales.printdialog(); reportviewersales.clear(); reportviewersales.localreport.releasesandboxappdomain(); } catch (exception ex) { } }
i gave quick class created print directly , think took ideas walkthrough: printing local report without preview
Comments
Post a Comment