Printing with ReportViewer Asp.Net

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 in the print preview the Print button in the report does not appear. So I decided to convert the print to PDF so yes, the option to print appears, but where it has an accent, it looks like this:

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

This column has already tried to put it as Varchar or Nvarchar and has 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 is the code for the button that fires print:

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

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

Thank you in advance.

    
asked by anonymous 29.01.2016 / 12:17

1 answer

2

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

    
30.06.2016 / 18:41