WPF - view and RDLC report file - wpf

I have an extensive WPF application and I now want to incorporate some reports. I understand how to create the reports with RDLC but what about viewing them? Ideally, I'd like to use the DocumentViewer but I don't think that's one of the supported file types. Some articles have suggested using the ReportViewer, but I do not have that as a control in my IDE (VS Pro 2008).
Is there a way to "convert" RDLC to XPS and then use the DocumentViewer or what is the best way for a WPF application to view an RDLC report?

The MicrosoftReportViewer control is a Windows Forms control. You can use the WindowsFormsHost control to "host" the report viewer control in WPF, as documented here.

Take a look at the Open-Source .NET WPF Reporting Engine on codeplex

Related

SSRS. Reports seem corrupted within the report viewer

I have a WPF application using server side SSRS reports. I'm using the WPF WinFormsHost control, embedding the winforms report viewer control, to display the reports.
On about 20 development pc's and client pc's everthing works ok. The problem is that in a new clients office, on 2 pc's only, the reports seem to be corrupted when viewing within the report viewer. (They print out fine)
Table data is ok, but header data field values are missing. Has anybody experienced this? I'm at a complete loss as to why on these 2 machines data seems to be missing in the report viewer.
Any help would be greatly appreciated.
The Winforms Report Viewer control is not designed to be embedded inside WPF application. You can use WindowsFormsHost Winforms control to host Report Viewer inside your WPF Application, but the data binding of the ReportViewer has to be handled programmatically, because the ReportViewer control will not have knowledge of WPF's Window datasource at all.
This is a sample walkthrough article of embedding Windows Forms control inside WPF: https://msdn.microsoft.com/en-us/library/ms750944.aspx

View PdfSharp document in a WPF control

I'm using the companion MigraDoc and PdfSharp libraries to generate a report.
The PdfSharp documentation repeatedly refers to WPF and talks about you can "draw on a PDF page as well as in a window", but I can't figure out how to view my PdfDocument in a viewer. All of the examples just kick the rendering off to another program by opening the documents with Process.Start().
Do either of these libraries include WPF controls for viewing the documents? Ideally I'm looking for a basic document viewer control, similar to the built-in RichTextEditor viewer for FlowDocuments.
(I'm using the PdfSharp and MigraDoc libraries that are distributed through NuGet.)
You can use WPF PDF Viewer. It wraps the Adobe PDF Reader COM Component as a WPF control
PDF Viewer is an ActiveX control which needed to be hosted using WindowsFormHost. If you need a WPF renderer for PDR, Adobe didnt introduced it yet. You need to create it yourself and parse the PDF document.
Here are few links which will help you how to host a PDF document on your WPF window :
http://www.codeproject.com/Articles/380019/Using-Adobe-Reader-in-a-WPF-app
http://hugeonion.com/2009/04/06/displaying-a-pdf-file-within-a-wpf-application/
Telerik has a PDF Viewer created using WPF which does the rendering of a PDF document using WPF. Its called RADPDFViewer
http://blogs.telerik.com/blogs/posts/12-02-29/introducing-pdf-viewer-for-silverlight-wpf.aspx
You have to either use one that is shipped by Adobe or you need to create it of your own just like Telerik did.

Report Viewer in WPF

I have a WPF project and I need to preview a crystal report. Is it possible to do this?
I can't find a report viewer control in WPF project.
thanks
You can use CrystalReportViewer of windows form with Windows form interop technology to add the viewer to your WPF applicaion.
see WindowsFormsHost Class

Excel WPF Addin Drag Drop Error

I created a Sidebar in Excel using WPF, and trying to drag some some objects from the WPF Pane to the spreadsheet. The Application object in WPF is null. Please guide me how to Achieve this Drag-Drop simple text from WPF Excel Addin to The spreadsheet.
Thanks in Advance
The answer for this problem is well explained in MSDN article section "Hosting WPF Content in a Microsoft Win32 Window"
This will be for any one who wants to get the power of WPF to build excel addins.

Using MS ReportViewer in WPF

I'm about to start using the MS ReportViewer in a WPF application by placing the ReportViewer in a WindowsFormsHost.
Is this the correct approach? What is the best way of designing the reports as you cannot use the ReportViewer at design time in a WindowsFormsHost.
Is it best to create an RDL report in SQL Server and then convert it to an RDLC or maybe to create a new Winforms app to create an RDLC file in a WinForms framework and then copy it to the WPF app.
I will need to filter the reports via dropdowns so there's that aspect to consider too. If anyone out there is already using ReportViewer in WPF I would appreciate some feedback on the best approach.....Many thanks.
Yes, that works, I am using the WindowsFormsHost in a wpf project to wrap the ReportViewer.
In the ViewModel I am creating the WindowsFormsHost and the ReportViewer:
WindowsFormsHost windowsFormsHost = new WindowsFormsHost();
reportViewer = new ReportViewer();
windowsFormsHost.Child = reportViewer;
this.Viewer = windowsFormsHost
and in the View I am using a ContentPresenter to display it, by binding to the Property that holds the WindowsFormsHost.
<ContentPresenter Content="{Binding Viewer}" ...
We're using the Business Intelligence Studio (which is an Visual Studio 2008 with templates for editing reports) for report creation. http://msdn.microsoft.com/en-us/library/ms173767.aspx
Take care,
Martin
We've definitely had success just using the WindowsFormsHost. I haven't been involved in creating the RDLC files themselves, but I believe they were designed (as you say) in a WinForms project and then copied across.
Note that if you don't need local reports you can use a WPF Frame control and point it at the URL of the server-based report (it renders it like a web browser would). This works really well for us too.
Please note that you can use both WPF-Windows and Windows-Form-Windows in the same application.
So you can avoid using WindowsFormsHost if you put the ReportViewer in a seperate Windows-Forms-Window that you open from your WPF-Window with ShowDialog.
Then you can use the ReportViewer also at design time.

Resources