简体   繁体   中英

Create Excel File With Limited Libraries in Java

I'm working in a framework that makes extensive use of excel documents, but the only imports it's using to do so are listed below:

java.io.*;
java.util.*;
java.util.regex.*;
java.util.zip.*;
javax.xml.parsers.*;
javax.xml.transform.*;
javax.xml.transform.dom.*;
javax.xml.transform.stream.*;
org.w3c.dom.*;

Because my workplace may not allow me to get the apache poi jar, how would I even begin to assemble an excel document using the above libraries?

The framework I'm working in is PRPC 7.x - most of the code it uses is proprietary and either hidden or incredibly inconvenient to get to, so it's rough trying to follow the breadcrumbs and mimic existing functionality.

如果您不被允许使用 apache,您仍然可以看看他们是如何做到的并模仿该代码。

There are two kinds of Excel files. The one is BIFF (Binary Interchange File Format) saved as *.xls files. The other is Office Open XML , a ZIP ed directory structure containing XML files saved as *.xlsx files. The latter you can assemble using the showed libraries.

You can simply create a simple *.xlsx file using Excel . Then open this *.xlsx file using a ZIP software. Now you can have a look at the directory structure of that ZIP archive and at the content of the XML files in it.

Now the challenge is to create the needed XML files keeping the proper relationships between them and to pack them as an ZIP archive using the proper directory structure and then naming that ZIP archive *.xlsx .

Belive me, it is a challenge ;-).

https://en.wikipedia.org/wiki/Office_Open_XML

通过他们的OOTB activtiy MSOParseExcel activtiy ...在那里他们压缩excel文件->解压缩它然后解析数据。

There are 2 OOTB activities using which we can generate the XLS. - ExportToExcel in @baseclass - ViewExportToExcel in Rule-Obj-HTML.

One of this should help, let me know if you need any more info.

RULESWARE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM