CrystalDecisions.CrystalReports.Engine: IndexOutRangeException
CrystalDecisions.CrystalReports.Engine: IndexOutRangeException
作業環境:
Windows Server 2003 Enterprise
Visual Basic .NET 2003
Crystal Report 10 For .NET 2003
程式碼片段:
oRpt.PrintOptions.PaperSize = PaperSize.PaperA4
oRpt.PrintOptions.PaperSource = PaperSource.Auto
oRpt.PrintToPrinter(1, False, 0, 0)
以上,第三行程式碼會產生一個 System.IndexOutOfRangeException 的錯誤
我有設中斷點查看錯誤,以下是 Exception 提供的資訊
ex.Source = CrystalDecision.CrystalReport.Engine
ex.Message = "索引在陣列的界限之外。"
ex.StackTrace =
at CrystalDecisions.CrystalReports.Engine.Migration.PrintOptionsConverter.EROMPaperSourceToDNETPaperSource(CrPaperSourceEnum ePaperSource)
at CrystalDecisions.CrystalReports.Engine.PrintOptions.get_PaperSource()
at CrystalDecisions.CrystalReports.Engine.PrintOptions.CopyTo(PrinterSettings printer, PageSettings page)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN)
at Shinher.fReport.ShowReport(Boolean PrintNow) in fReport.vb:line 1238
ex.InnerException = Nothing
我亦在監看式中加入 oRpt.PrintOptions
PaperSource 那個成員亦出現了相同的錯誤:
<error: an exception of type: {System.IndexOutOfRangeException} occurred>
程式中加入 PaperSize 及 PaperSource 那兩行設定,照樣出現這個錯誤。
奇怪的是在別的程式中,同樣的方法,根本也不用設定 Paper,並沒有這個問題,
在這支程式中會發生這個錯誤,每一張報表都一樣,
只要執行到 PrintToPrinter 這行就發生錯誤,
如果使用 CrystalReportViewer 先預覽,再點畫面中的列印按鈕,可以正常列印。
我還異想天開的改成 oRpt.PrintToPrinter(1, False, 1, 1),也沒有用
預覽畫面就可以確定報表檔案本身並沒有問題,資料來源也是可以正確秀在報表上的
真的就不知道這到底是什麼問題了,
請問是 CrystalReport 的 bug 嗎?還是其它問題?該如何解決呢?
--
▃▅▇▆▄ ▆▂▃ `
逝去感情如何能留住,半點癡情遺留殊不易,██▅▇▄▃ ▇▃▂" .
█████████▃i ▁▄▇
更多悽悽慘慘的遭遇…………██▆▃ █▅▆▃ˍ▄*
◢ ▂█▄▇▅▂▌.
我不知道,王~八~蛋~~! ▂▆███ █▄▃ 。fumizuki。Check。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.248.175.60
推
04/13 20:46, , 1F
04/13 20:46, 1F
推
04/14 06:22, , 2F
04/14 06:22, 2F
→
04/19 19:50, , 3F
04/19 19:50, 3F