@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { if (localName.equalsIgnoreCase(SHEET)) { String name = null; String id = null; for (int i = 0; i < attrs.getLength(); i++) { final String attrName = attrs.getLocalName(i); if (attrName.equalsIgnoreCase(NAME)) { name = attrs.getValue(i); } else if (attrName.equalsIgnoreCase(ID)) { id = attrs.getValue(i); } if (name != null && id != null) { sheetRefs.add(new XSSFSheetRef(id, name)); break; } } } }
private boolean tryOldFormat(byte[] data) throws XSSFBParseException { //undocumented what is contained in these 8 bytes. //for the non-beta xlsb files, this would be 4, not 8. int offset = 8; long iTabID = LittleEndian.getUInt(data, offset); offset += LittleEndian.INT_SIZE; if (iTabID < 1 || iTabID > 0x0000FFFFL) { throw new XSSFBParseException("table id out of range: "+iTabID); } StringBuilder sb = new StringBuilder(); offset += XSSFBUtils.readXLWideString(data, offset, sb); String relId = sb.toString(); sb.setLength(0); offset += XSSFBUtils.readXLWideString(data, offset, sb); String name = sb.toString(); if (relId.trim().length() > 0) { sheets.add(new XSSFSheetRef(relId, name)); } if (offset == data.length) { return true; } return false; }
private void tryToAddWorksheet(byte[] data) throws XSSFBParseException { int offset = 0; //this is the sheet state #2.5.142 /*long hsShtat =*/ //noinspection ResultOfMethodCallIgnored LittleEndian.getUInt(data, offset); offset += LittleEndian.INT_SIZE; long iTabID = LittleEndian.getUInt(data, offset); offset += LittleEndian.INT_SIZE; //according to #2.4.304 if (iTabID < 1 || iTabID > 0x0000FFFFL) { throw new XSSFBParseException("table id out of range: "+iTabID); } StringBuilder sb = new StringBuilder(); offset += XSSFBUtils.readXLWideString(data, offset, sb); String relId = sb.toString(); sb.setLength(0); /*offset +=*/ XSSFBUtils.readXLWideString(data, offset, sb); String name = sb.toString(); if (relId.trim().length() > 0) { sheets.add(new XSSFSheetRef(relId, name)); } }
private boolean tryOldFormat(byte[] data) throws XSSFBParseException { //undocumented what is contained in these 8 bytes. //for the non-beta xlsb files, this would be 4, not 8. int offset = 8; long iTabID = LittleEndian.getUInt(data, offset); offset += LittleEndian.INT_SIZE; if (iTabID < 1 || iTabID > 0x0000FFFFL) { throw new XSSFBParseException("table id out of range: "+iTabID); } StringBuilder sb = new StringBuilder(); offset += XSSFBUtils.readXLWideString(data, offset, sb); String relId = sb.toString(); sb.setLength(0); offset += XSSFBUtils.readXLWideString(data, offset, sb); String name = sb.toString(); if (relId.trim().length() > 0) { sheets.add(new XSSFSheetRef(relId, name)); } if (offset == data.length) { return true; } return false; }
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { if (localName.equalsIgnoreCase(SHEET)) { String name = null; String id = null; for (int i = 0; i < attrs.getLength(); i++) { final String attrName = attrs.getLocalName(i); if (attrName.equalsIgnoreCase(NAME)) { name = attrs.getValue(i); } else if (attrName.equalsIgnoreCase(ID)) { id = attrs.getValue(i); } if (name != null && id != null) { sheetRefs.add(new XSSFSheetRef(id, name)); break; } } } }
private void tryToAddWorksheet(byte[] data) throws XSSFBParseException { int offset = 0; //this is the sheet state #2.5.142 /*long hsShtat =*/ //noinspection ResultOfMethodCallIgnored LittleEndian.getUInt(data, offset); offset += LittleEndian.INT_SIZE; long iTabID = LittleEndian.getUInt(data, offset); offset += LittleEndian.INT_SIZE; //according to #2.4.304 if (iTabID < 1 || iTabID > 0x0000FFFFL) { throw new XSSFBParseException("table id out of range: "+iTabID); } StringBuilder sb = new StringBuilder(); offset += XSSFBUtils.readXLWideString(data, offset, sb); String relId = sb.toString(); sb.setLength(0); /*offset +=*/ XSSFBUtils.readXLWideString(data, offset, sb); String name = sb.toString(); if (relId.trim().length() > 0) { sheets.add(new XSSFSheetRef(relId, name)); } }