print RDLC direct without reportviewer

130 Views

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

report.render( image deviceinfo addressof createstream warnings)  error
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<Stream> m_streams;
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;
}

Leave a Reply

Your email address will not be published.

Skip to toolbar