Send ReportViewer result to mail

2 posts, 0 answers
  1. JOSE
    JOSE avatar
    29 posts
    Member since:
    Jul 2015

    Posted 09 Aug Link to this post

    Hi, I'm too newer in Telerik Reporting, and I not have idea to when make a ReportViewer or Telerik.Reporting.Report, I have an example works fine, is a report with 2 parameter, and I can see it on screen or sent to printer, now I want to sent it to user mail, without interaction of user, how I can do this? I'm work in WPF with VS2013,  annexed my code:

     

    in XAML:
    <tr:ReportViewer Name="ReportViewer1" Width="800" Height="500" >
        <tr:ReportViewer.ReportSource>
            <telerikReporting:TypeReportSource TypeName="ReportLibrary, ReportLibrary" />
        </tr:ReportViewer.ReportSource>
    </tr:ReportViewer>
    in .cs:
    var TRS = new TypeReportSource();
    TRS.TypeName = typeof(pgoRelacionCobranza).AssemblyQualifiedName;
    ReportViewer1.ReportSource = TRS;

    FechaIni = dpFechaIni.SelectedDate.Value.Day.ToString() +"/" + dpFechaIni.SelectedDate.Value.Month.ToString() + "/" + dpFechaIni.SelectedDate.Value.Year.ToString();
    FechaFin = dpFechaFin.SelectedDate.Value.Day.ToString() + "/" + dpFechaFin.SelectedDate.Value.Month.ToString() + "/" + dpFechaFin.SelectedDate.Value.Year.ToString();
                   
    var TRS = new TypeReportSource();
    TRS.TypeName = typeof(pgoRelacionCobranza).AssemblyQualifiedName;
    TRS.Parameters.Add(new Telerik.Reporting.Parameter("pFechaIni", FechaIni));
    TRS.Parameters.Add(new Telerik.Reporting.Parameter("pFechaFin", FechaFin));
    ReportViewer1.ReportSource = TRS;
    if (rbPantalla.IsChecked == true)
    {
        ReportViewer1.RefreshReport();
        stkReportView.Visibility = System.Windows.Visibility.Visible;
    }
    else
    {
        System.Windows.Forms.PrintDialog printDlg = new System.Windows.Forms.PrintDialog();
        printDlg.AllowSomePages = true;
        printDlg.AllowCurrentPage = false;
        printDlg.UseEXDialog = true;
        DialogResult result = printDlg.ShowDialog();
        // If the result is OK then print the document.
        if (result == DialogResult.OK)
        {
            ReportProcessor reportProcessor = new ReportProcessor();
            reportProcessor.PrintReport(TRS, printDlg.PrinterSettings);
        }
    }

  2. Silviya
    Admin
    Silviya avatar
    176 posts

    Posted 14 Aug Link to this post

    Hello Jose,

    We have available KB article on how to Send Telerik Report in an E-Mail. The goal of the KB is to provide one possible solution to implement emailing of reports, and help get the project started. 
    As a side note, emailing the report from the report viewers is part of Telerik Reporting Roadmap for the upcoming release (R3 2018 Sep)

    Regards,
    Silviya
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top