如何创建和写入Excel文件(.xlsx)? [英] How to create and write to Excel file (.xlsx)?

查看:537
本文介绍了如何创建和写入Excel文件(.xlsx)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java开发人员的库有大量无法在Android上运行的方法。

There are libraries for Java developers that have tons of methods which do not work on Android.

我开始使用像OpenCSV这样的库,但遗憾的是Excel已经已知问题,包含打开的CSV文件。

I started by working with libraries like OpenCSV, but unfortunately Excel has known issues with opening CSV files.

然后我尝试使用:


  • Apache POI - 肯定有太多方法。

  • JExcelAPI - 它可以工作,但仅适用于旧的二进制.xls文件。

  • docx4j - 再次太多的jar,因为它基于JAXB,这是不包含在Android中。

我的问题是,如何在Android上创建.xlsx格式的简单Excel文件,不超过65k方法?

My question is, how can I create a simple Excel file in .xlsx format on Android, without exceeding 65k methods?

推荐答案

第一个答案:做服务器端。

First answer: do it server-side.

如果那是不可能的,只需使用JExecelAPI - 几乎所有读取xlsx文件的内容都会读取xls文件。

If that's not possible, just use JExecelAPI - pretty much everything that reads xlsx files reads xls files too.

每个其他Excel库都会太大了。

Every other Excel library is going to be way too big.

另一个想法 - 手动编写csv文件,或者使用许多可用的csv库之一。同样,大多数读取Excel文件的应用程序也会读取csv文件。

Another thought - write csv files, either manually, or with one of the many csv libraries available. Again, most applications that read Excel files read csv files too.

这篇关于如何创建和写入Excel文件(.xlsx)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆