2017-06-13 49 views
0

在PDF中打開2個Crystal Reports我是Crystal Reports的新手。 我做了2份報告,我想以PDF格式打開。以參數

我只想要具有特定ID的報告。 僅限Atm「Containerlijst」報告ID爲 ,但顯示「PersAfdruk」,PersAfdruk顯示「PersAfdruk」的所有ID。

隨着代碼我得到了我打開相同的報告2次。 但我給了不同的名字。 使用MVVM和此代碼是在我的命令。

try 
     { 
      Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; 

      ReportDocument PersAfdruk = new ReportDocument(); 
      ReportDocument Containerlijst = new ReportDocument(); 
      PersAfdruk.Load("../../Persorderlijst.rpt"); 
      PersAfdruk.SetParameterValue("PersOrderID", txtPersOrderID); 
      Containerlijst.Load("../../Containerlijst.rpt"); 
      Containerlijst.SetParameterValue("PersOrderID", txtPersOrderID); 

      ExportOptions CrExportOptions; 
      DiskFileDestinationOptions CrDiskFileDes = new DiskFileDestinationOptions(); 
      PdfRtfWordFormatOptions CrFormat = new PdfRtfWordFormatOptions(); 
      CrDiskFileDes.DiskFileName = "d:\\Persorderlijst.pdf"; 
      CrDiskFileDes.DiskFileName = "d:\\Containerlijst.pdf"; 
      CrExportOptions = PersAfdruk.ExportOptions; 
      { 
       CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; 
       CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; 
       CrExportOptions.ExportDestinationOptions = CrDiskFileDes; 
       CrExportOptions.ExportFormatOptions = CrFormat; 
      } 
      PersAfdruk.Export(); 
      Process.Start("d:\\Persorderlijst.pdf"); 
      Process.Start("d:\\Containerlijst.pdf"); 

     } 

回答

0

這可能不是優雅的方式來做到這一點,但它爲我工作。 反饋歡迎。

try 
     { 
      Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; 

      ReportDocument PersAfdruk = new ReportDocument(); 
      ReportDocument Containerlijst = new ReportDocument(); 
      PersAfdruk.Load("../../Persorderlijst.rpt"); 
      PersAfdruk.SetParameterValue("PersOrderID", txtPersOrderID); 
      Containerlijst.Load("../../Containerlijst.rpt"); 
      Containerlijst.SetParameterValue("PersOrderID", txtPersOrderID); 

      ExportOptions CrExportOptions; 
      ExportOptions CrExportOptions1; 
      DiskFileDestinationOptions CrDiskFileDes = new DiskFileDestinationOptions(); 
      DiskFileDestinationOptions CrDiskFileDes1 = new DiskFileDestinationOptions(); 
      PdfRtfWordFormatOptions CrFormat = new PdfRtfWordFormatOptions(); 
      PdfRtfWordFormatOptions CrFormat1 = new PdfRtfWordFormatOptions(); 
      CrDiskFileDes.DiskFileName = "d:\\Persorderlijst.pdf"; 
      CrDiskFileDes1.DiskFileName = "d:\\Containerlijst.pdf"; 
      CrExportOptions = PersAfdruk.ExportOptions; 

      { 
       CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; 
       CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; 
       CrExportOptions.ExportDestinationOptions = CrDiskFileDes; 
       CrExportOptions.ExportFormatOptions = CrFormat; 
      } 
      CrExportOptions1 = Containerlijst.ExportOptions; 
      { 
       CrExportOptions1.ExportDestinationType = ExportDestinationType.DiskFile; 
       CrExportOptions1.ExportFormatType = ExportFormatType.PortableDocFormat; 
       CrExportOptions1.ExportDestinationOptions = CrDiskFileDes1; 
       CrExportOptions1.ExportFormatOptions = CrFormat1; 
      } 
      PersAfdruk.Export(); 
      Containerlijst.Export(); 

      Process.Start("d:\\Persorderlijst.pdf"); 
      Process.Start("d:\\Containerlijst.pdf"); 

     }