Android 中的 Excel 导出 [英] Excel export in Android
问题描述
我需要从我的 Android 应用程序中导出 excel.我使用 Apache-POI 库,当我运行我的应用程序NoClassDefFoundError"时出现异常.但是类在poi-ooxml-3.9-20121203.jar"中,并且jar作为外部jar连接.我认为在 android 开发中使用该库是不可能的.任何可以帮助我解决这些问题的想法或库:
I need to export excel from my android app. I use Apache-POI library and I get en exception when I run my app "NoClassDefFoundError". But the class is in "poi-ooxml-3.9-20121203.jar" and the jar is connected as external jar. I suppose that it is impossible to use that lib in android development. Any idea or library which can help me for these points:
- 创建 Excel 文件
- 读取并向其中添加行
推荐答案
我也一直在尝试将 Apache POI 用于我的应用程序,我的结论是它具有与 Android 冲突的依赖项.至少,即使付出了相当大的努力,我也无法让它发挥作用.
I have been trying to use Apache POI for my app too and my conclusion was that it has dependencies that conflict with Android. Atleast I was not able to make it work, even with a quite amount of effort.
如果你想导出的excel文件比较简单,我建议用jxl代替.不幸的是,这个库只支持旧的 excel 格式.
If the excel documents you wish to export are rather simple, I would suggest using jxl instead. This library unfortunately only supports old excel formats though.
Lars Vogel 制作了一个很好的教程,展示了如何做到这一点:http://www.vogella.com/articles/JavaExcel/article.html
Lars Vogel has made a nice tutorial showing how this is done: http://www.vogella.com/articles/JavaExcel/article.html
不使用 POI 的另一个论据是图书馆的大小.它相当大,因此会对您的应用大小产生巨大影响.
Yet another argument for not using POI is the size of the library. It is rather big, hence leaving a huge impact on your app size.
如果您真的想使用 POI,我建议为它创建一个简单的 Web 服务,让您的应用调用它来创建 Excel 文档.
If you really want to use POI, I suggest creating a simple web service for it, having your app call that to create the excel documents.
这篇关于Android 中的 Excel 导出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!