Printing RDLC report and report viewer
YUI-012
160
Reputation points
While printing my receipt using thermal paper its show like this.
Sorry for the long image, as you can see not all data of my report is printed,
And this is my expected base on my RDLC report viewer.
and this is my report properties., I already check this part but still not working for me.
and last is my code, to call or to print the report.
public void LoadThermal_report()
{
reportViewer2.SetDisplayMode(DisplayMode.PrintLayout);
//reportViewer2.SetDisplayMode(DisplayMode.Normal);
//var setup = reportViewer2.GetPageSettings();//for margin
//setup.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);//(lift, , TOP , )
//reportViewer2.SetPageSettings(setup);
ReportParameterCollection reportParameters = new ReportParameterCollection();
reportParameters.Add(new ReportParameter("Current_date", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss tt")));
this.reportViewer2.LocalReport.SetParameters(reportParameters);
////code start
//carrentalDataSet carrentalDataSet = new carrentalDataSet();
string ConnectionString = Db_Connection_String.ConnectionString;
MySqlConnection con = new MySqlConnection(ConnectionString);
MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM db_rentedconplete_payment WHERE invoice='" + txtinvoice.Text + "'", con);
carrentalDataSet ds = new carrentalDataSet();//name of your own dataset
da.Fill(ds, "db_rentedconplete_payment");//name of your db
ReportDataSource dataSource = new ReportDataSource("DataSet1", ds.Tables[0]);//name of your dataset
this.reportViewer2.LocalReport.DataSources.Clear();
this.reportViewer2.LocalReport.DataSources.Add(dataSource);
this.reportViewer2.LocalReport.EnableExternalImages = true;
this.reportViewer2.LocalReport.Refresh();
this.reportViewer2.RefreshReport();
}
I already check my code, and I don't know why still not print my data in my report as you can see at the 1st top of the image. Please help me to fix this problem.
Developer technologies | C#
11,582 questions
Sign in to answer