【问题标题】:How to IKVM Apache POI如何 IKVM Apache POI
【发布时间】:2012-11-21 00:51:41
【问题描述】:

我想在我的 .NET 应用程序中使用 Apache POI,我知道有一个端口 NPOI,但它不完整并且没有 PowerPoint 相关的功能。

我尝试使用以下命令对其进行 IKVM:

ikvmc -target:library poi-3.8.jar poi-ooxml-3.8.jar poi-ooxml-schemas-3.8.jar poi-excelant-3.8.jar poi-scratchpad-3.8.jar

但是在使用生成的 dll 中的类后,我执行了应用程序,得到了这个错误:

The type initializer for 'org.apache.poi.xslf.usermodel.XMLSlideShow' threw an exception.

谁能指引我到我可以下载 IKVMed Apache POI 的链接,用 Google 搜索,但目前运气不佳。

【问题讨论】:

  • 微软不提供 .NET API 来处理 Mircorsoft Office 文档吗?
  • 是的,但是为合并 powerpoint 平台提供的代码会引发错误,并且 Apache POI 有一个专门用于此的类,我想试试这个。
  • 您联系过 Microsoft 支持吗?他们对这个错误有什么看法?
  • 您不需要也包含dependencies 吗? IIRC,您需要一次性将它们与主要 POI jar 一起传递
  • 我已经添加了 src 中存在的每个 jar,以免遗漏任何一个,但仍然会出现“Type Initializer”错误。

标签: c# java apache apache-poi ikvm


【解决方案1】:

我刚刚完成了使用 IKVM 成功转换 POI 3.9 的项目。

先决条件:

  • 下载 POI 3.9 并将所有 JAR 文件复制到一个目录中
  • 下载IKVM(我用的是0.46.0.1版本)

以下命令(在所有 POI JAR 所在的同一目录中的 Windows 7 命令行中运行)对我有用:

ikvmc -target:library xmlbeans-2.3.0.jar
ikvmc -target:library stax-api-1.0.1.jar

ikvmc poi-ooxml-schemas-3.9-20121203.jar -target:library -reference:xmlbeans-2.3.0.dll -reference:stax-api-1.0.1.dll 


ikvmc -target:library log4j-1.2.13.jar
ikvmc -target:library commons-logging-1.1.jar
ikvmc -target:library commons-codec-1.5.jar

ikvmc poi-3.9-20121203.jar -target:library -reference:log4j-1.2.13.dll -reference:commons-logging-1.1.dll -reference:commons-codec-1.5.dll

ikvmc -target:library dom4j-1.6.1.jar

ikvmc poi-ooxml-3.9-20121203.jar -target:library -reference:poi-3.9-20121203.dll -reference:poi-ooxml-schemas-3.9-20121203.dll -reference:dom4j-1.6.1.dll -reference:xmlbeans-2.3.0.dll

希望对你有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-23
    • 1970-01-01
    • 2015-09-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多