Answered by:
Print preview in Report Viewer

Question
-
Hi,
I am using report viewer tool. The problem which i am facing is at run time when i go to print preview mode it show all the pages black. When i tried to print all those pages, printing was fine. How can i replace these black pages with origional pages.
Thanks,
Somay-
Thursday, November 29, 2007 3:16 PM
Answers
-
I have found one solution at http://support.microsoft.com/kb/935436
If anybody knows other possible solution, please suggest
Thanks,
Wednesday, January 2, 2008 8:09 PM
All replies
-
Hi Somay,
I am not sure what you mean by the report viewer tool. If you mean the ReportViewer control, I guess you may set the back color of the ReportViewer control to black. You can click on the “Print Layout” button to check if you can see the report. I have the following code, and it works well on my machine.
Code BlockDataTable dt = new DataTable();// used as the data source of the report
private void CusForm_Load(object sender, EventArgs e)
{
dt.Columns.Add("Id");
dt.Columns.Add("Name");
for (int i = 1; i < 200; i++)
{
dt.Rows.Add(i.ToString("00"), "Name" + i.ToString("00"));
}
dt.AcceptChanges();
this.dataGridView1.DataSource = dt;
}
private void btnViewReport_Click(object sender, EventArgs e)
{
reportViewer1.LocalReport.ReportEmbeddedResource = "ReportTest.CusReport.rdlc";
reportViewer1.LocalReport.DataSources.Clear();
//set the data source, the first patameter is the name of the datasource which you bind your report table to
reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("CusDataSet_Person", dt));
// set the parameter of the report
Microsoft.Reporting.WinForms.ReportParameter rp = new Microsoft.Reporting.WinForms.ReportParameter("title", this.textBox1.Text);
reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter[] { rp });
this.reportViewer1.RefreshReport();
}
Let me know if this helps. If not, Could you please provide some more details?
Hope this helps.
Best regards.
Rong-Chun ZhangTuesday, December 4, 2007 7:31 AM -
Thanks Zhang,
My bad, I am using Report viewer control . The problem is when I click the Print Layout button on the report I get a black page and only report title and group headers are visible.Tthe report still prints fine on the printer but none of the data is visible in the report in print layout mode.
Regards,
Wednesday, December 26, 2007 10:05 PM -
I have found one solution at http://support.microsoft.com/kb/935436
If anybody knows other possible solution, please suggest
Thanks,
Wednesday, January 2, 2008 8:09 PM