How to directly print rdlc report without showing PrintDialog() in C#?

后端 未结 3 2055
星月不相逢
星月不相逢 2020-12-06 10:38

I have an application where I have to print a RDLC report without showing the printDialog and using the default specified printer defined in the application. Be

3条回答
  •  执笔经年
    2020-12-06 11:06

    i have made an extension class to @tezzos answer. which might make it more easier.

    use this Gist Here to get the extension class i wrote. include it to your project. don't for get namespace :D

    LocalReport report = new LocalReport();
                report.ReportEmbeddedResource = "Your.Reports.Path.rdlc";
                report.DataSources.Add(new ReportDataSource("DataSet1", getYourDatasource()));
                report.PrintToPrinter();
    

    PrintToPrinter Method will be available on LocalReport. Might Help someone

提交回复
热议问题