Средство просмотра отчетов в формате WPF ReportDocument не работает - PullRequest
0 голосов
/ 11 марта 2020

Я пытаюсь показать файл отчета в моем приложении WPF в VS2017. Код CS1 отлично работает и запрашивает данные подключения. В CS2 я хочу сделать это через ReportDocument, но у меня есть только колесо ожидания с серым фоном, и Viewer не запрашивает данные соединения. Есть идеи как это сделать? Мне нужно сделать это методом 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>

1 Ответ

0 голосов
/ 12 марта 2020

Мне нужно было установить CrforVS Runtime, и теперь он отлично работает

...