print RDLC direct without reportviewer
hi every body i have a windows form with gridview which bind from datatable and i have adataset which gets values from datatable it works fine and i try it in reportviewer it works correctly but how can i print RDLC direct without reportviewer
alaaPosted Apr 24, 2015, 3:47 AM
i read more but no way this my code i need help
private void btnprint_Click(object sender, EventArgs e)
{
ds = new DataSet1();
int RowsCount = dgvsell.Rows.Count -1;// Dt.Rows.Count;
if (RowsCount != 0 || RowsCount != null)
{
for (int i = 0; i < RowsCount; i++)
{
DataRow dr = ds.Tables[0].NewRow();
dr[0] = this.dgvsell[2, i].Value.ToString();
dr[1] = this.dgvsell[4, i].Value.ToString();
dr[2] = this.dgvsell[5, i].Value.ToString();
dr[3] = this.dgvsell[6, i].Value.ToString();
ds.Tables[0].Rows.Add(dr);
}
}
loadReceipt3();
print2();
}
private void loadReceipt3()
{
LocalReport localreport = new LocalReport();
localreport.ReportPath = @"..\..\Report1.rdlc";
localreport.DataSources.Clear();
localreport.DataSources.Add(new ReportDataSource("DataTable1", ds.Tables[0]));
Export(localreport);
print2();
}
private IList
private int m_currentPageIndex;
private Stream CreateStream(string name, string fileNameExtension, Encoding encoding, string mimeType, bool willSeek)
{
Stream stream = new MemoryStream();
m_streams.Add(stream);
return stream;
}
Gowtham RajamanickamPosted Apr 24, 2015, 12:29 AM
Siva SankarPosted Apr 24, 2015, 12:05 AM
Here I am Sending a link to you.It will useful to you....
https://social.msdn.microsoft.com/Forums/en-US/9f52d79d-5baf-4e84-97d5-7dbba6623b89/printing-without-the-reportviewer?forum=vsreportcontrols
alaaPosted Apr 23, 2015, 5:07 PM
LocalReport report = new LocalReport();
report.DataSources.Add(new ReportDataSource("DataTable1", ds.Tables[0]));
report.ReportEmbeddedResource = "Market.Report1.rdlc";
printDocument1.Print();
datset have values but it print nothing the reporter is empty
beacsuce it cant read the path of Report1.rdlc despite its correct path
i also try that to get the correct path
Application.StartupPath + "\\Report1.rdlc";
but nothing
can any one help ??