問題:在VB程式裡面調用水晶報表轉換成Pdf,又出現亂碼的解決,
方法:
1.如果你的水晶報表是8.5,轉換水晶報表後中文會是亂碼的,那麼你在VB裡引用要改一下:
Crystal Reports 8.5 ActiveX Designer and Runtime library
Crystal Reports 9.0 ActiveX Designer Runtime library
一定要先去掉以下選項,否則會出錯
Crystal Reports 8.5 ActiveX Designer Runtime library
2.數據源、參數設定
Dim crApp As CRAXDRT.Application
Dim crReport As CRAXDRT.Report
Set crReport = crApp.OpenReport(App.Path & "/Report/報表名.rpt", 1)
'設定各報表指向的數据源
crReport.Database.setDataSource l_Rs 'l_Rs 自己寫設定Adodb.Recordset
crReport.ParameterFields.GetItemByName("報表參數名").AddCurrentValue (參數值)