【问题标题】:Report Viewer in WPF ReportDocument type doesnt workWPF ReportDocument 类型中的报表查看器不起作用
【发布时间】:2020-06-23 14:41:53
【问题描述】:

我试图在 VS2017 的 WPF 应用程序中显示报告文件。 CS1 代码完美运行并要求连接数据。在 CS2 中,我想通过 ReportDocument 来完成,但我只等待带有灰色背景的轮子,并且查看器不要求连接数据。知道怎么做吗?我需要用 CS2 方法来做。

CS1:

cryrep.ViewerCore.ReportSource = "C:\\Reports\\GeneralBusiness\\testDB.rpt";
cryrep.ViewerCore.RefreshReport();

CS2:

CrystalDecisions.CrystalReports.Engine.ReportDocument crReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
crReportDocument.Load("C:\\Reports\\GeneralBusiness\\testDB.rpt", CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy);

cryrep.ViewerCore.ReportSource = crReportDocument;
cryrep.ViewerCore.RefreshReport();

我的 XAML:

<UserControl
x:Class="ReportingPortal.Views.ReportingPortalFilterView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behaviors="clr-namespace:UCM.Infrastructure.Behaviors;assembly=UCM.Infrastructure"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cr="clr-namespace:SAPBusinessObjects.WPF.Viewer;assembly=SAPBusinessObjects.WPF.Viewer"
xmlns:lex="http://wpflocalizeextension.codeplex.com"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
lex:LocalizeDictionary.DesignCulture="de"
lex:ResxLocalizationProvider.DefaultAssembly="ReportingPortal"
lex:ResxLocalizationProvider.DefaultDictionary="Resources"
prism:ViewModelLocator.AutoWireViewModel="True"
KeyboardNavigation.TabNavigation="Cycle"
mc:Ignorable="d">
<Grid Background="{DynamicResource LightLightBaseColorBrush}">

    <cr:CrystalReportsViewer
        x:Name="cryrep"
        Width="1000"
        Height="1600"
        Margin="-14,0,0,0"
        HorizontalAlignment="Left"
        VerticalAlignment="Top" />

</Grid>

【问题讨论】:

    标签: c# wpf report reportviewer


    【解决方案1】:

    我必须安装 CrforVS Runtime,现在它运行完美

    【讨论】:

      猜你喜欢
      • 2014-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多