Here is the latest.

I found out that the Pivot tables that I need are in cache stored in sheet rId11
So I use the following code to convert to XML. However it does not have any
style or schema. So its pretty much useless. 
I used the example that Roberto and Dave pointed to.

OPCPackage pkg = OPCPackage.open("test.xlsx");
XSSFReader r = new XSSFReader( pkg );
SharedStringsTable sst = r.getSharedStringsTable();
                        
DOMParser parser = new DOMParser();
InputStream inp = r.getSheet("rId11");
InputSource inpSource = new InputSource(inp);
parser.parse(inpSource);
                        
Document doc = parser.getDocument();
inp.close();

OutputStream writer = new FileOutputStream("outtrId11.xml");
TransformerFactory transfac = TransformerFactory.newInstance();
Transformer trans = transfac.newTransformer();
                        
trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
trans.setOutputProperty(OutputKeys.INDENT, "yes");
trans.setOutputProperty(OutputKeys.ENCODING, "UTF-8");

//create string from xml tree
                        
StreamResult result = new StreamResult(writer);
DOMSource source = new DOMSource(doc);
trans.transform(source, result);


The XML file generated was as below
 
This XML file does not appear to have any style information associated with it.
The document tree is shown below.      
−
<pivotCacheDefinition createdVersion="1" r:id="rId1" recordCount="6907"
refreshedBy="" refreshedDate="40097.989743171296">
<cacheSource connectionId="2" type="external"/>
−
<cacheFields count="86">
−
<cacheField name="Number" numFmtId="0" sqlType="4">
−
<sharedItems containsInteger="1" containsNumber="1" containsSemiMixedTypes="0"
containsString="0" count="6904" maxValue="9750" minValue="1">
<n v="9739"/>
<n v="9738"/>
<n v="9736"/>
<n v="9740"/>
<n v="9733"/>
<n v="9732"/>

... 

Not sure where to go from here.

Thanks.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
For additional commands, e-mail: user-h...@poi.apache.org

Reply via email to