2016-09-09 32 views
0

WPFプロジェクトでCrystal Reportsが使用されています。すべてが開発中に機能します。レポートがロードされて表示され、DataSetに問題はありません。次のコードでは、レポートを呼び出します。レポートでクライアントマシンの空白ページが表示される

ReportDocument report = new ReportDocument(); 
    report.Load("../../CrystalReport.rpt"); 
    CustomerLedgerDataSet ds = new CustomerLedgerDataSet(); 
    DataTable dt1 = ds.BillProduct; 
    DataTable dt2 = ds.Customer; 
    foreach (var item in customer.CustomerCollection) 
    { 
     dt2.Rows.Add(item.Customerid, item.CustomerName, item.CustomerLocation, 
        item.Customerbalance, item.CustomerLastTally, item.Customerphone); 
    } 
    report.SetDataSource(ds); 
    crystalReportsViewer2.ViewerCore.ReportSource = report; 

これは開発時には動作しますが、クライアントのPCに展開した場合は動作しません。レポートビューアが表示されますが、空のレポートが表示されます。それはパスがうまくできないため、犯人はこの行です:

report.Load("../../CrystalReport.rpt");

enter image description here enter image description here

私は展開のために公開し、一度クリックして、クライアントPCにCrystalランタイムの同じバージョンをインストール。

+0

参照DLLをコピーしていますか?参照を右クリックし、プロパティを選択します。コピーローカルフィールドで、真を選択します。 –

+0

彼らはすでにクリスタルレポートのために特に真実です –

答えて

1

多くのフォルダを使用しないでください。 レポートをプロジェクトフォルダ自体にコピーしてみてください。このパスのようなレポートフォルダから移動してください

report.Load("~/CrystalReport.rpt") 
関連する問題