How to create .docx files and .xlsx files on Android

前端 未结 4 815
一生所求
一生所求 2020-12-09 11:08

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

相关标签:
4条回答
  • 2020-12-09 11:45

    normally you only must to do this:

    FileOutputStream archivoSalida;
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sht = wb.createSheet("Conciliacion");
    ...
    ...
    archivoSalida = new FileOutputStream(fileDestination);
    wb.write(archivoSalida);
    archivoSalida.close();
    

    But it seems that your problem is not in the code. Is in the libraries and the compilation. I'am wrong?

    0 讨论(0)
  • 2020-12-09 11:48

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

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

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

    0 讨论(0)
  • 2020-12-09 11:50

    You can use docx4j to create .docx files.

    docx4j is an open source (Apache v2) library for creating, editing, and saving OpenXML "packages", including docx, pptx, and xslx.

    So you need to use JAXB-based Java library for Word docx.

    This is a helpful tutorial for that: http://www.javacodegeeks.com/2012/07/java-word-docx-documents-with-docx4j.html

    Then your next question "is that compatible with the android ? " Look at this: JAXB can be made to run on Android

    I think this will help you.

    0 讨论(0)
  • 2020-12-09 12:01

    Try using http://jexcelapi.sourceforge.net/

    The jar file has a very simple apis, to manipulate/create Excel sheets.

    0 讨论(0)
提交回复
热议问题