Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# .NET printing Reports RDLC view , +
Hi everyone
I have a report viewer that programmatically display a rdlc report when user click a button
in button event i do the following:
 System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
 pg.Landscape = true;
 pg.Margins.Top = 2;
 pg.Margins.Bottom = 2;
 pg.Margins.Left = 40;
 pg.Margins.Right = 2;
 system.Drawing.Printing.PaperSize size = new PaperSize();
 size.RawKind = (int)PaperKind.A4Extra;
 pg.PaperSize = size;
 DataTable dt = ReceiptsManager.GetAvowelsReportDT(<Parameters>);
 if (dt != null && dt.Rows.Count > 0)
   reportViewer1.LocalReport.ReportPath = <RDLC Report Path>
   ReportDataSource RDS = new ReportDataSource();
   RDS.Name = <RDLC Report Dataset Name>;
   RDS.Value = dt;
the report displayed well but when i click on Printpreview button the viewer displayed a small black box without any contents and when i press right click and choose a pagesetup i see my predefined settings and when i press OK the report displayed
So i want to solve this problem and when user click Printpreview the report displayed with predefined settings
Thanks in advance
Posted 3-Jul-13 6:24am
Edited 3-Jul-13 6:28am
mgoad99 at 3-Jul-13 13:47pm
I have not had the same exact problem you describe, but i do know that users have to install an active x control to print from the report viewer (same as if running the report directly in the report manager). Typically, the first time a user tries to print they will get a message asking them to install the control. After they install it, they do not get that message anymore. Maybe there is an issue with the control that is giving your users a small black box instead of the message to install?
AhmedYehiaK at 3-Jul-13 21:37pm
as i mention before after we see the small black box i press right click and choose PageSetup then i see all the settings which i programmatically set then press OK
then the small black box disappeared and the report displayed well
So i can see and print the report as well but the whole problem in what i mention

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 445
1 Sergey Alexandrovich Kryukov 322
2 Maciej Los 275
3 CHill60 195
4 King Fisher 179
0 OriginalGriff 240
1 Maciej Los 95
2 Sascha Lefévre 85
3 King Fisher 70
4 F-ES Sitecore 55

Advertise | Privacy | Mobile
Web01 | 2.8.150331.1 | Last Updated 3 Jul 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100