What is the best way to display a report without installing anything on the client

I am a novice developer who develops software for a company, although I am very familiar with programming. I rarely develop software for a company, now, after I joined the company, I had a problem creating software.

I have to develop software that can be easily installed and updated on the client computer, I solve it with clickonce, then there is a problem, almost all the software that I develop should have a report viewer, I try to use reportviewer from microsoft, but it give me more problems during installation, I try everything I found on the Internet to make an installation that is easy to install, but I continue to struggle with installing reportviewer, it keeps an error on some computer, although sometimes to be installed without error on a different computer.

I need to suggest how I can develop a program that can display a report and print it without installing any other program on the client. I am using C # in Visual Studio 2015, I am developing WPF and using it on the web.

+4
source share
2 answers

Use nuget in your project and add the following dependencies to it

Microsoft.ReportViewer.2015.Runtime

Microsoft.ReportViewer.VS2015.WinForms

Run the report viewer as follows:

var dlg = new ReportPreviewDialog();
dlg.ReportViewer.LocalReport.DisplayName = "My report";
dlg.ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("datasource1", data));
dlg.ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("datasource2", data2));
dlg.ReportViewer.LocalReport.ReportEmbeddedResource = "YourClient.TheReport.rdlc";
dlg.ShowDialog();

TheReport.rdlc- your report as a resource in your project (=> Build Action: Embedded Resource). Make sure the namespace is correct or your report is not found.

Works with WPF.

+7
source

Try visiting the Deploy reports and ReportViewer controls.

If the first option does not work, you can try this step.

  • Go to the properties of your project or press (Alt + Enter).
  • Click the Publish tab.
  • " " " ".
  • DLL Microsoft.ReportViewer / ().
  • "".

:

0

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


All Articles