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

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

Introduction

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

Prototype

public XSSFExportToXml(XSSFMap map) 

Source Link

Document

Creates a new exporter and sets the mapping to be used when generating the XML output document

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);//w  ww  .ja v a 2s.  c o m
        String xml = os.toString("UTF-8");
        System.out.println(xml);
    }
    pkg.close();
}