How to IKVM Apache POI

2019-07-15 11:15发布

问题:

I want to use Apache POI in my .NET application, I know there is a port NPOI but it's not complete and don't have PowerPoint related functionality.

I've tried to IKVM it by using the following command:

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

but when after using the classes in resulting dll I've executed the application, got this error:

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

can someone direct me to the link where I can download IKVMed Apache POI, Googled it but didn't have much luck as of now.

回答1:

I just finished the project where I have successfully converted POI 3.9 using IKVM.

Prerequisites:

  • Download POI 3.9 and copy all the JAR files into one directory
  • Download IKVM (I used version 0.46.0.1)

The following commands (run in Windows 7 command line in the same directory where all the POI JARs are) did the trick for me:

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

Hope it helps.