Click here to Skip to main content
Rate this: bad
good
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;
 reportViewer1.SetPageSettings(pg);
 
 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;
   reportViewer1.LocalReport.DataSources.Clear();
   reportViewer1.LocalReport.DataSources.Add(RDS);
 
   this.reportViewer1.RefreshReport();
 }
 
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
v2
Comments
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 190
1 Jochen Arndt 155
2 PIEBALDconsult 150
3 Afzaal Ahmad Zeeshan 120
4 DamithSL 115
0 OriginalGriff 5,695
1 DamithSL 4,591
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 3 Jul 2013
Copyright © CodeProject, 1999-2014
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