I am using crystal report in a WPF application designed in visual studio 2010. I have used two report viewers to display crystal report;
1 : Microsoft.ReportViewer.WinForms
Code :
<Window x:Class="HelloWorld.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:rv="clr- namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"
Title="WFReportViewer" Height="800" Width="900">
<Grid>
<WindowsFormsHost Height="700" Name="windowsFormsHost1" Width="800">
<rv:ReportViewer x:Name="_reportViewer" />
</WindowsFormsHost>
</Grid>
</Window>
Output :
[Post I run the above code, below is the output][1]
[1]:
https://i.stack.imgur.com/MHRSu.png
[When I click on page setup, I get this option ][2]
[2]:
https://i.stack.imgur.com/sVgby.png
So, I can do page setup, view the changes, and can print the report then.
2: SAP CrystalReportsViewer
Code :
<Window x:Class="HelloWorld.CrystalReportWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:SAPBusinessObjects.WPF.Viewer;assembly=SAPBusinessObjects.WPF.Viewer"
Title="CrystalReportWindow" Height="800" Width="900" Loaded="Window_Loaded">
<Grid Name="grid1">
<my:CrystalReportsViewer HorizontalAlignment="Left" Name="crystalRptVwr1" VerticalAlignment="Top" Height="700" Width="850" ShowOpenFileButton="False" ShowPrintButton="True" ShowExportButton="True" SnapsToDevicePixels="False" UseLayoutRounding="False" />
</Grid>
</Window>
Output :
[When I run this code, I get this output][3]
[3]:
https://i.stack.imgur.com/dJJG3.png
Now, an only print option is available here. there is no layout option or page setup option in crystal report viewer. I need to add them so that after we run crystal report, the user should be able to change page setup and check it's preview.
I have searched on the internet a lot, but not able to find any solution. Can anyone please advice and help me on this?
Thanks in advance.
What I have tried:
I have tried creating my own print option and custom window to set page setup, but that is not covering all scenarios. Also, it is getting my application slow. I searched on the internet a lot but didn't find any solution.