Click here to Skip to main content
15,887,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a report generated programmatically with Report Viewer 2008 using Visual Studio 2010.The toolbar is enabled with ShowPrintButton set to 'True' .

When the print button is clicked, report is generated. I need to change the page settings to change the layout to 'landscape' or 'portrait' based on users requirement.

Thanks
Posted
Updated 23-Oct-12 8:48am
v2
Comments
Rohit Shrivastava 23-Oct-12 11:36am    
one option could be reversing the height and width at runtime based on parameters.

1 solution

Try something along the lines of:
C#
LocalReport myReport = new LocalReport();
ReportPageSettings repPgSettings = myReport.GetDefaultPageSettings();

//Flip the page
double height = repPgSettigs.PaperSize.Height;
repPgSettigs.PaperSize.Height = repPgSettigs.PaperSize.Width;
repPgSettigs.PaperSize.Width = height;
 
Share this answer
 
Comments
abc0077 24-Oct-12 3:22am    
Hi,

Thanks for your response.
But i couldnot change the height.
it threw me an error
'PaperSize cannot be changed unless the Kind property is set to Custom.'

Papersize is readonly , so i dont know how it can be assigned.

Thanks

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900