C# 将DatagridView打印到rdlc报告
如何将项目从dataGridview打印到rdlc报告。 dataGridView中的项目是手动填充的,而不是从数据库填充的,这就是为什么这会给我带来问题 p、 s我知道有很多方法可以用PrintForm打印,但我想用.rdlc打印 尝试使用DataTable,但它没有显示屏幕上的正确列 RDLC数据集C# 将DatagridView打印到rdlc报告,c#,printing,report,rdlc,C#,Printing,Report,Rdlc,如何将项目从dataGridview打印到rdlc报告。 dataGridView中的项目是手动填充的,而不是从数据库填充的,这就是为什么这会给我带来问题 p、 s我知道有很多方法可以用PrintForm打印,但我想用.rdlc打印 尝试使用DataTable,但它没有显示屏幕上的正确列 RDLC数据集 我试着填充一个数据表,然后将这些项目传递到一个数据集中,但它没有显示正确的列。我只是编辑了线程,你可以看到我使用的代码。-它没有显示DataGrid的正确列和行,而是显示不存在的行。如果你愿意,
我试着填充一个数据表,然后将这些项目传递到一个数据集中,但它没有显示正确的列。我只是编辑了线程,你可以看到我使用的代码。-它没有显示DataGrid的正确列和行,而是显示不存在的行。如果你愿意,我可以发布一个截图
DataSet ds = new DataSet();
DataTable dt = new DataTable("ProdFromDGV");
foreach (DataGridViewColumn col in dataGridView1.Columns)
{
dt.Columns.Add(col.HeaderText);
}
foreach (DataGridViewRow row in dataGridView1.Rows)
{
DataRow dRow = dt.NewRow();
foreach (DataGridViewCell cell in row.Cells)
{
dRow[cell.ColumnIndex] = cell.Value;
}
dt.Rows.Add(dRow);
}
ds.Tables.Add(dt);
dt.WriteXml("table.xml");`