我愿意在.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
- 下载JasperReports 3.7.0 项目,将 \lib 中的所有 jar 和JasperReports-3.7.0.jar 分组在一个文件夹中
- 使用jar2ikvmc生成 ikmvc 脚本http://code.google.com/p/jar2ikvmc/downloads/list
- 运行脚本我收到很多ClassNotDefound警告
- 引用了 C# 应用程序中的所有 DLL,以及除 ikvm-native.dll 之外的所有 IKVM dll
异常堆栈跟踪
在 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()