1

我愿意在.Net 中使用 JasperReports。

我使用 IKVM.net 构建了所需的 DLL,并翻译了一个示例应用程序。

但是我在 C# 中得到了 NotImplementedExeption(Java 中的等效代码完美运行)

JasperPrint print = JasperFillManager.fillReport(jasperFileDialog.FileName, null, new JREmptyDataSource());

该方法或操作未实现。

请参阅下面的堆栈跟踪


注: IKVM 版本:0.40.0.1 http://sourceforge.net/projects/ikvm/files/ikvm/0.40.0.1/ikvmbin-0.40.0.1.zip/download


异常堆栈跟踪

在 net.sf.jasperreports.engine.fill.JRBaseFiller.fill(地图参数值)
   在 net.sf.jasperreports.engine.fill.JRBaseFiller.fill(映射参数值,JRDataSource ds)
   在 net.sf.jasperreports.engine.fill.JRFiller.fillReport(JasperReport jasperReport,地图参数,JRDataSource 数据源)
   在 net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperReport jasperReport,地图参数,JRDataSource 数据源)
   在 net.sf.jasperreports.engine.JasperFillManager.fillReport(字符串 sourceFileName,地图参数,JRDataSource 数据源)
   在 Jasper.Net.Form1.ExportButton_Click(Object sender, EventArgs e) 在 C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Jasper.Net\Jasper.Net\Form1.cs:line 39
   在 System.Windows.Forms.Control.OnClick(EventArgs e)
   在 System.Windows.Forms.Button.OnClick(EventArgs e)
   在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs 事件)
   在 System.Windows.Forms.Control.WmMouseUp(消息和 m,MouseButtons 按钮,Int32 点击)
   在 System.Windows.Forms.Control.WndProc(消息和 m)
   在 System.Windows.Forms.ButtonBase.WndProc(消息和 m)
   在 System.Windows.Forms.Button.WndProc(消息和 m)
   在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息和 m)
   在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)
   在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(味精和味精)
   在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID,Int32 原因,Int32 pvLoopData)
   在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 原因,ApplicationContext 上下文)
   在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 原因,ApplicationContext 上下文)
   在 System.Windows.Forms.Application.Run(窗体 mainForm)
   在 Jasper.Net.Program.Main() 在 C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Jasper.Net\Jasper.Net\Program.cs:line 18
   在 System.AppDomain._nExecuteAssembly(程序集程序集,字符串 [] 参数)
   在 System.AppDomain.ExecuteAssembly(字符串 assemblyFile,证据 assemblySecurity,String [] args)
   在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   在 System.Threading.ThreadHelper.ThreadStart_Context(对象状态)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态)
   在 System.Threading.ThreadHelper.ThreadStart()
4

1 回答 1

0

当 Jasper Reports jar 依赖于另一个 jar 时,通常会发生 class not found 异常。例如,如果jasperreport.jar使用另一个 jar log4net.jar,您首先需要将依赖的 jar 转换为 dll。然后在jasperreport的转换过程中使用转换后的dll进行链接。将 Apache POI 转换为 dll 时,我遇到了同样的问题。

于 2011-09-26T01:39:38.013 回答