poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47520] New: [PATCH] Implementation of an XLSX to XML Exporter using Custom XML Mapping
Date Mon, 13 Jul 2009 15:32:58 GMT

           Summary: [PATCH] Implementation of an XLSX to XML Exporter
                    using Custom XML Mapping
           Product: POI
           Version: 3.5-dev
          Platform: PC
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: roberto.manicardi@gmail.com

Created an attachment (id=23968)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23968)
Diff for file XSSFRelation

In a XSLX you can set one or more mapping rule to define how to exchange data
from and to an external XML. This part is called Custom XML Mapping (see
http://openxmldeveloper.org/articles/2268.aspx for a pratical example)

This patch implements the Custom XML mapping part and an XML exporter that,
using the mapping saved in an XLSX, exports the data from the worksheets to an
XML stream.

The following example shows how to create an XML with the mapping identified by
mapId and prints it to console:

 int mapId = // your map ID
 XSSFWorkbook wb = // load an XLSX file with mapping informations      
 MapInfo mapInfo = null;

 for(POIXMLDocumentPart p : wb.getRelations()){
     if(p instanceof MapInfo){
         mapInfo = (MapInfo) p;
     XSSFMap map = mapInfo.getXSSFMapById(mapId);
     XSSFExportToXml exporter = new XSSFExportToXml(map);
     ByteArrayOutputStream os = new ByteArrayOutputStream();
     String xml = os.toString("UTF-8");

Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message