How to create a report in MVVM WPF application without a database link

I am trying to create a report in my WPF application. I am using Visual Studio 2010, C # and MVVM

I researched a lot and just found articles on the web that deal with Crystal Report using a database. In my application, I will not directly contact the database. We use a web service. It contacts the database and writes all the data to xml files. We get our information through stored procedures. I hope it's not a problem.

In any case, on one of my user controls, I have a data id that is populated with data from the database. I store this data using the List and Observable collection. Thus, getting data is easy. But now I would like to export the data to a print report. A.

As I said, I read reports, and they all use some form of data set or data set. But, as I said, we do not use the database directly.

I downloaded SAP Crystal Reports, the developer version for Microsoft Visual Studio: real-time updates and downloads to ensure that I can use Crystal Reports,

I have an idea that I should create a new User Control or Window View and set the datacontext via the ViewModel. This form must have a Report Viewer control that will be populated. But I don’t know what to do if I can do something like that. Can I send a / ObservableCollection list with the data I want to save in the form and bind it to the report control? Using [this] as an example 2 , this is the direction I'm looking for

Or is there another way to create a report without using a database? Usually I want to create a report in my existing WPF project. A new window or user control opens, and the report viewer with the data contained in the gridview is loaded here. Using WPF and MVVM, how do I achieve this.

One, - , . - .

, , - , ,

+4
2

, , , . , , - , - DocumentPaginator. , .XPS, / XPS PDF.

, !

0

, -, DataSource EF- -. ( SQL Server ( )).

Windows Forms:( MSDN WPF

+1

Source: https://habr.com/ru/post/1530002/


All Articles