@SuppressWarnings("deprecation") //YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support
protected void readFrom(InputStream is) throws IOException {
try {
doc = StyleSheetDocument.Factory.parse(is);
CTStylesheet styleSheet = doc.getStyleSheet();
// Grab all the different bits we care about
CTNumFmts ctfmts = styleSheet.getNumFmts();
if( ctfmts != null){
for (CTNumFmt nfmt : ctfmts.getNumFmtArray()) {
numberFormats.put((int)nfmt.getNumFmtId(), nfmt.getFormatCode());
}
}
CTFonts ctfonts = styleSheet.getFonts();
if(ctfonts != null){
int idx = 0;
for (CTFont font : ctfonts.getFontArray()) {
// Create the font and save it. Themes Table supplied later
XSSFFont f = new XSSFFont(font, idx);
fonts.add(f);
idx++;
}
}
CTFills ctfills = styleSheet.getFills();
if(ctfills != null){
for (CTFill fill : ctfills.getFillArray()) {
fills.add(new XSSFCellFill(fill));
}
}
CTBorders ctborders = styleSheet.getBorders();
if(ctborders != null) {
for (CTBorder border : ctborders.getBorderArray()) {
borders.add(new XSSFCellBorder(border));
}
}
CTCellXfs cellXfs = styleSheet.getCellXfs();
if(cellXfs != null) xfs.addAll(Arrays.asList(cellXfs.getXfArray()));
CTCellStyleXfs cellStyleXfs = styleSheet.getCellStyleXfs();
if(cellStyleXfs != null) styleXfs.addAll(Arrays.asList(cellStyleXfs.getXfArray()));
CTDxfs styleDxfs = styleSheet.getDxfs();
if(styleDxfs != null) dxfs.addAll(Arrays.asList(styleDxfs.getDxfArray()));
} catch (XmlException e) {
throw new IOException(e.getLocalizedMessage());
}