如何创建的.docx Android上的文件和文件的.xlsx文件、docx、Android、xlsx

2023-09-12 10:00:34 作者:俯下身吻妳﹌

我有一个非常简单的问题:如何建立的.docx 和的.xlsx 在Android上的文件。之前有人将以此为重复的,让我告诉你,我已经广泛地尝试使用Apache POI创造他们和我尝试在这些问题描述:

I have a very simple question: How to create .docx and .xlsx files on Android. Before someone marks this as duplicate, let me tell you that I have extensively tried creating them using Apache POI and my attempts are described in these questions:

java.lang.NoClassDefFoundError同时建立使用Apache POI 一个.xlsx文件

Creating使用POI-OOXML的jar文件 .docx文件

然而,在这些链接中所述,我正在 java.lang.verify误差。这些都是我终于导入到我的参考库的jar文件:

However, as described in those links, I am getting the java.lang.verify error. These are the jar files I have finally imported into my reference libraries:

的dom4j-1.6.1.jar

dom4j-1.6.1.jar

POI-3.10-FINAL-20140208.jar

poi-3.10-FINAL-20140208.jar

POI-OOXML-3.10-FINAL-20140208.jar

poi-ooxml-3.10-FINAL-20140208.jar

STAX-API-1.0.1.jar

stax-api-1.0.1.jar

XMLBeans的-2.3.0.jar

xmlbeans-2.3.0.jar

POI-OOXML-模式-3.10-FINAL-20140208.jar

poi-ooxml-schemas-3.10-FINAL-20140208.jar

commons- codeC-1.5.jar

commons-codec-1.5.jar

共享记录-1.1.jar

commons-logging-1.1.jar

的JUnit 4.11.jar

junit-4.11.jar

log4j的-1.2.13.jar

log4j-1.2.13.jar

但现在不编译所有,并说这个控制台

but now it doesn't compile at all, and says this on the console

Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.

This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.

However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. This will most
assuredly not work. At a minimum, it jeopardizes the
compatibility of your app with future versions of the platform.
It is also often of questionable legality.

If you really intend to build a core library -- which is only
appropriate as part of creating a full virtual machine
distribution, as opposed to compiling an application -- then use
the "--core-library" option to suppress this error message.

If you go ahead and use "--core-library" but are in fact
building an application, then be forewarned that your application
will still fail to build or run, at some point. Please be
prepared for angry customers who find, for example, that your
application ceases to function once they upgrade their operating
system. You will be to blame for this problem.

If you are legitimately using some code that happens to be in a
core package, then the easiest safe alternative you have is to
repackage that code. That is, move the classes in question into
your own package namespace. This means that they will never be in
conflict with core system classes. JarJar is a tool that may help
you in this endeavor. If you find that you cannot do this, then
that is an indication that the path you are on will ultimately
lead to pain, suffering, grief, and lamentation.

[2014-02-19 16:59:24 - test] Dx 1 error; aborting
[2014-02-19 16:59:24 - test] Conversion to Dalvik format failed with error 1

请指教,什么我做的。

编辑:

我的最终目的的是:我想创建的.docx和的.xlsx文件和添加一些内容以他们。一旦创建了文件,我应该能够成功地查看他们的 PC系统我所连接的手机上。

My end purpose is: I wish to create .docx and .xlsx files and add some content to them. Once the files are created, I should be able to successfully view them on the PC system which I have connected the phone to.

编辑2:找到一个解决办法,产生的的.xlsx 按文件的删除所有这些依赖关系,并使用 JS preadsheet -1.0 jar文件。但我还是不知道该怎么办了的.docx 文件。

EDIT 2: Found a workaround to generate .xlsx files by removing all these dependencies and using jspreadsheet-1.0 jar file. But I still don't know what to do for .docx files.

修订问题:

看来我的问题在于使用不支持搭载Android的POI jar文件。可有人请我提供的链接,我可以得到POI 特别作为机器人?

It seems my problem lies with using the POI jar files which is not supported by Android. Can someone please supply me the link where I can get POI specifically for Android?

或者,可以有人请告诉我如何创建的.docx 的文件,我可以添加内容,并使得它们可以被看作?

Or, can someone please tell me how to create .docx files to which I can add content, and such that they can be viewed?

推荐答案

使用的Apache POI库不仅是因为它是最好的在那里。

Use Apache POI library only because It is the best out there.

谷歌也在其快处使用它应用为Android。

Google also uses it in its Quick Office Application for Android.

有关的。*** x喜欢的docx文件,XLSX,它可能在的Dalvik上允许的某些功能的限制。

For the .***x files like docx and xlsx, It might have some limits on the allowed functions in Dalvik.