Example usage for org.apache.poi.xssf.extractor XSSFExportToXml exportToXML

List of usage examples for org.apache.poi.xssf.extractor XSSFExportToXml exportToXML

Introduction

In this page you can find the example usage for org.apache.poi.xssf.extractor XSSFExportToXml exportToXML.

Prototype

public void exportToXML(OutputStream os, boolean validate) throws SAXException, TransformerException 

Source Link

Document

Exports the data in an XML stream

Usage

From source file:packtest.CustomXMLMapping.java

License:Apache License

public static void main(String[] args) throws Exception {
    OPCPackage pkg = OPCPackage.open(args[0]);
    XSSFWorkbook wb = new XSSFWorkbook(pkg);

    for (XSSFMap map : wb.getCustomXMLMappings()) {
        XSSFExportToXml exporter = new XSSFExportToXml(map);

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        exporter.exportToXML(os, true);
        String xml = os.toString("UTF-8");
        System.out.println(xml);/* www .j a v  a2 s .c o m*/
    }
    pkg.close();
}