/**
* Parses an inputstream containin xlsx into an outputStream containing XML
*
* @param inputStream
* the source
* @param outputStream
* the result
* @throws IOException
* @throws XMLStreamException
*/
public void parse(final InputStream inputStream, final OutputStream outputStream)
throws IOException, XMLStreamException {
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XMLStreamWriter out = this.getXMLWriter(outputStream);
out.writeStartDocument();
out.writeStartElement("workbook");
int sheetCount = workbook.getNumberOfSheets();
for (int i = 0; i < sheetCount; i++) {
final XSSFSheet sheet = workbook.getSheetAt(i);
try {
this.export(sheet, out);
} catch (UnsupportedEncodingException | FileNotFoundException | XMLStreamException
| FactoryConfigurationError e) {
e.printStackTrace();
}
}
out.writeEndElement();
out.writeEndDocument();
out.close();
workbook.close();
}
E2xCmdline.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:Excel2XML
作者:
评论列表
文章目录