https://issues.apache.org/bugzilla/show_bug.cgi?id=47520
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: [email protected]
ReportedBy: [email protected]
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();
exporter.exportToXML(os,true);
String xml = os.toString("UTF-8");
System.out.println(xml);
}
}
--
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: [email protected]
For additional commands, e-mail: [email protected]