Printing with Reportviewer Asp.Net

Asked

Viewed 752 times

2

Good afternoon, I’d like some help.

I am generating an impression by Reportviewer with Visual Studio 2010, the report is generated correctly but the print view does not show the Print button in the report. So I decided to convert the printing to PDF ai yes now appears the option to print, but where have accent is like this:

      teste de então         - que o certo seria - teste de então

This column has already tried to put her as Varchar or Nvarchar and gets the same problem.

Follow the Code of the report page:

ReportViewer1.Reset();
                    ReportViewer1.LocalReport.DataSources.Clear();

                    // atribuiu o caminho onde está o relatorio .rdlc
                    ReportViewer1.LocalReport.ReportPath = @"Relatorio\RelAcompanharOcorrencias.rdlc";

                    // cria e atribui o datasource
                    ReportDataSource dts = new ReportDataSource("DataSet1", dt);
                    ReportViewer1.LocalReport.DataSources.Add(dts);
                    //ReportViewer1.LocalReport.Refresh();

                    var bytes = ReportViewer1.LocalReport.Render("PDF");
                    Response.Buffer = true;
                    Response.ContentType = "application/pdf";
                    Response.AddHeader("content-disposition", "inline;attachment; filename=Sample.pdf");
                    Response.BinaryWrite(bytes);
                    Response.Flush(); // send it to the client to download
                    Response.Clear();

Below follows the Code of the button that triggers printing:

DataTable dt = new DataTable();
            if (gridHome.Rows.Count > 0)
            {
                dt = ObjOcorrencia.converterGridViewParaDataTable(gridHome);
                Session["dtimpressao"] = dt;
                Redirect("Relatorio/fRelAcompanharOcorrencias.aspx","_blank","");
            }

If anyone has a solution either to put the print button or to fix this accent problem thank you

Grateful from now on.

  • Welcome to SOPT. Would like to [Edit] your post and add the code you are using, so we can analyze and suggest a change. Thank you

  • 1

    Is already added.

  • Have you tried using the PRINT method? Reportprintdocument Rp = new Reportprintdocument(Reportviewer1.Serverreport); Rp.Print();

  • Yes, but the print-only save button does not display. The print button does not display

1 answer

2


The print button in the VS2010 Reportviewer only appears in internet explorer, update your project to VS2013 or VS2015, update the reportViewer libraries and the button will be available in other brows

Browser other questions tagged

You are not signed in. Login or sign up in order to post.