2012-12-03 81 views
2

我想在我的.NET應用程序中使用Apache POI,我知道有一個端口NPOI,但它不完整,沒有PowerPoint相關功能。如何IKVM Apache POI

我試着用下面的命令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,谷歌搜索,但沒有太多的運氣,現在。

+0

Microsoft是否提供.NET API以與Mircorsoft Office文檔一起使用? – Puce

+0

是的,但提供的代碼提供合併PowerPoint演示文稿錯誤,並且Apache POI有一個專門的類,我想試試這個。 – Ali

+0

您是否聯繫過Microsoft支持?他們對這個錯誤說什麼? – Puce

回答

3

我剛剛完成了使用IKVM成功轉換POI 3.9的項目。

先決條件:

  • 下載POI 3.9和所有的JAR文件複製到一個目錄
  • 下載IKVM(我使用0.46.0.1版)

以下命令(在Windows中運行7命令行在所有POI JAR所在的同一目錄中)爲我做了訣竅:

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 

希望它有幫助。