在客户端不安装任何东西的情况下显示报告的最佳方式是什么
What is the best way to display report without installing anything on client
我是一个为公司开发软件的新手开发者,虽然我对编程很熟悉我很少为公司开发软件,现在加入公司后我开始制作软件时遇到问题.
我必须开发一个可以在客户端计算机上轻松安装和更新的软件,我使用clickonce解决了这个问题,然后问题就来了,我开发的几乎所有软件都必须有报表查看器,我尝试使用微软的reportviewer,但这在安装时给我带来了更多问题,我尝试了我在网上找到的所有东西来进行易于安装的设置,但是我在安装 reportviewer 时一直很挣扎,它在某些计算机上保持错误,尽管有时它在其他计算机上安装时没有错误。
我需要一个建议,告诉我如何开发一个程序来显示和打印报告,而无需在客户端上安装任何其他程序。我在 Visual Studio 2015 年使用 C#,我开发 WPF,并在 Web 上使用它。
在你的项目中使用nuget,并添加如下依赖
Microsoft.ReportViewer.2015.Runtime
Microsoft.ReportViewer.VS2015.WinForms
像这样启动您的报告查看器:
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
是您的报告作为项目中的资源(=> 构建操作:嵌入式资源)。请确保命名空间正确,否则将找不到您的报告。
使用 WPF。
尝试访问这个Deploying Reports and ReportViewer Controls.
如果第一个选项不起作用,您可以尝试此步骤。
- 转到您的项目属性或按 (Alt + Enter)。
- 单击“发布”选项卡。
- 在“安装模式和设置”中单击“应用程序文件”按钮。
- 查找所有 Microsoft.ReportViewer dll 和 select 发布状态 Include/Include(自动)。
- 单击“确定”。
这是一些图片:
我是一个为公司开发软件的新手开发者,虽然我对编程很熟悉我很少为公司开发软件,现在加入公司后我开始制作软件时遇到问题.
我必须开发一个可以在客户端计算机上轻松安装和更新的软件,我使用clickonce解决了这个问题,然后问题就来了,我开发的几乎所有软件都必须有报表查看器,我尝试使用微软的reportviewer,但这在安装时给我带来了更多问题,我尝试了我在网上找到的所有东西来进行易于安装的设置,但是我在安装 reportviewer 时一直很挣扎,它在某些计算机上保持错误,尽管有时它在其他计算机上安装时没有错误。
我需要一个建议,告诉我如何开发一个程序来显示和打印报告,而无需在客户端上安装任何其他程序。我在 Visual Studio 2015 年使用 C#,我开发 WPF,并在 Web 上使用它。
在你的项目中使用nuget,并添加如下依赖
Microsoft.ReportViewer.2015.Runtime
Microsoft.ReportViewer.VS2015.WinForms
像这样启动您的报告查看器:
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
是您的报告作为项目中的资源(=> 构建操作:嵌入式资源)。请确保命名空间正确,否则将找不到您的报告。
使用 WPF。
尝试访问这个Deploying Reports and ReportViewer Controls.
如果第一个选项不起作用,您可以尝试此步骤。
- 转到您的项目属性或按 (Alt + Enter)。
- 单击“发布”选项卡。
- 在“安装模式和设置”中单击“应用程序文件”按钮。
- 查找所有 Microsoft.ReportViewer dll 和 select 发布状态 Include/Include(自动)。
- 单击“确定”。
这是一些图片: