- Code: Select all
SpreadsheetMLPackage pkg = (SpreadsheetMLPackage)zip.get(java.nio.file.Files.newInputStream(p))
WorkbookPart workbookPart = pkg.workbookPart
Workbook wb = workbookPart.jaxbElement
...
workbookPart.relationships.relationships.relationship.each { println it.target + ": " + it.type + ": " + it.id}
...
wb.sheets.sheet.each { println it.name + ": " + it.id + ": " + it.sheetId }
gives me
- Code: Select all
styles.xml: http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles: rId1
worksheets/sheet1.xml: http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet: rId2
worksheets/sheet2.xml: http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet: rId3
worksheets/sheet3.xml: http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet: rId4
worksheets/sheet4.xml: http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet: rId5
worksheets/sheet5.xml: http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet: rId6
worksheets/sheet6.xml: http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet: rId7
sharedStrings.xml: http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings: rId8
attributes: rId2: 1
worksheet2 rId3: 2
worksheet3: rId4: 3
worksheet4: rId5: 4
worksheet5 rId6: 5
worksheet6: rId7: 6
I want access the data in the "attributes" tab of the workbook.
What do I do from here? I've tried using the relationships to get the part, the part name (but the URI seems to be malformed from the "target" name).
Also, I find the need to navigate through object properties like workbookPart.relationships.relationships.relationship to get to a list a bit hard to navigate and understand.