styleSheet.setNumFmts(formats); CTFonts ctFonts = styleSheet.getFonts(); if (ctFonts == null) { ctFonts = CTFonts.Factory.newInstance(); for(XSSFFont f : fonts) ctfnt[idx++] = f.getCTFont(); ctFonts.setFontArray(ctfnt); styleSheet.setFonts(ctFonts); CTFills ctFills = styleSheet.getFills(); if (ctFills == null) { ctFills = CTFills.Factory.newInstance(); for(XSSFCellFill f : fills) ctf[idx++] = f.getCTFill(); ctFills.setFillArray(ctf); styleSheet.setFills(ctFills); CTBorders ctBorders = styleSheet.getBorders(); if (ctBorders == null) { ctBorders = CTBorders.Factory.newInstance(); for(XSSFCellBorder b : borders) ctb[idx++] = b.getCTBorder(); ctBorders.setBorderArray(ctb); styleSheet.setBorders(ctBorders); CTCellXfs ctXfs = styleSheet.getCellXfs(); if (ctXfs == null) { ctXfs = CTCellXfs.Factory.newInstance();
IndexedColorMap customColors = CustomIndexedColorMap.fromColors(styleSheet.getColors()); if (customColors != null) indexedColors = customColors; CTNumFmts ctfmts = styleSheet.getNumFmts(); if( ctfmts != null){ for (CTNumFmt nfmt : ctfmts.getNumFmtArray()) { CTFonts ctfonts = styleSheet.getFonts(); if(ctfonts != null){ int idx = 0; CTFills ctfills = styleSheet.getFills(); if(ctfills != null){ for (CTFill fill : ctfills.getFillArray()) { CTBorders ctborders = styleSheet.getBorders(); if(ctborders != null) { for (CTBorder border : ctborders.getBorderArray()) { 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())); CTTableStyles ctTableStyles = styleSheet.getTableStyles();
CTNumFmts ctfmts = styleSheet.getNumFmts(); if( ctfmts != null){ for (CTNumFmt nfmt : ctfmts.getNumFmtArray()) { CTFonts ctfonts = styleSheet.getFonts(); if(ctfonts != null){ int idx = 0; CTFills ctfills = styleSheet.getFills(); if(ctfills != null){ for (CTFill fill : ctfills.getFillArray()) { CTBorders ctborders = styleSheet.getBorders(); if(ctborders != null) { for (CTBorder border : ctborders.getBorderArray()) { 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()));
ctFmt.setFormatCode(fmt.getValue()); styleSheet.setNumFmts(formats); for(XSSFFont f : fonts) ctfnt[idx++] = f.getCTFont(); ctFonts.setFontArray(ctfnt); styleSheet.setFonts(ctFonts); for(XSSFCellFill f : fills) ctf[idx++] = f.getCTFill(); ctFills.setFillArray(ctf); styleSheet.setFills(ctFills); for(XSSFCellBorder b : borders) ctb[idx++] = b.getCTBorder(); ctBorders.setBorderArray(ctb); styleSheet.setBorders(ctBorders); xfs.toArray(new CTXf[xfs.size()]) ); styleSheet.setCellXfs(ctXfs); styleXfs.toArray(new CTXf[styleXfs.size()]) ); styleSheet.setCellStyleXfs(ctSXfs); ctDxfs.setDxfArray(dxfs.toArray(new CTDxf[dxfs.size()]) ); styleSheet.setDxfs(ctDxfs);
public void setDefaultPivotStyle(String style){ getCTStylesheet().getTableStyles().setDefaultPivotStyle(style); }
public void setDefaultTableStyle(String style){ getCTStylesheet().getTableStyles().setDefaultTableStyle(style); }
styleSheet.setNumFmts(formats); CTFonts ctFonts = styleSheet.getFonts(); if (ctFonts == null) { ctFonts = CTFonts.Factory.newInstance(); for(XSSFFont f : fonts) ctfnt[idx++] = f.getCTFont(); ctFonts.setFontArray(ctfnt); styleSheet.setFonts(ctFonts); CTFills ctFills = styleSheet.getFills(); if (ctFills == null) { ctFills = CTFills.Factory.newInstance(); for(XSSFCellFill f : fills) ctf[idx++] = f.getCTFill(); ctFills.setFillArray(ctf); styleSheet.setFills(ctFills); CTBorders ctBorders = styleSheet.getBorders(); if (ctBorders == null) { ctBorders = CTBorders.Factory.newInstance(); for(XSSFCellBorder b : borders) ctb[idx++] = b.getCTBorder(); ctBorders.setBorderArray(ctb); styleSheet.setBorders(ctBorders); CTCellXfs ctXfs = styleSheet.getCellXfs(); if (ctXfs == null) { ctXfs = CTCellXfs.Factory.newInstance();
IndexedColorMap customColors = CustomIndexedColorMap.fromColors(styleSheet.getColors()); if (customColors != null) indexedColors = customColors; CTNumFmts ctfmts = styleSheet.getNumFmts(); if( ctfmts != null){ for (CTNumFmt nfmt : ctfmts.getNumFmtArray()) { CTFonts ctfonts = styleSheet.getFonts(); if(ctfonts != null){ int idx = 0; CTFills ctfills = styleSheet.getFills(); if(ctfills != null){ for (CTFill fill : ctfills.getFillArray()) { CTBorders ctborders = styleSheet.getBorders(); if(ctborders != null) { for (CTBorder border : ctborders.getBorderArray()) { 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())); CTTableStyles ctTableStyles = styleSheet.getTableStyles();
public String getDefaultPivotStyle(){ return getCTStylesheet().getTableStyles().getDefaultPivotStyle(); }
public String getDefaultTableStyle(){ return getCTStylesheet().getTableStyles().getDefaultTableStyle(); }
private void importTableStyles(XLSXStylesTable styles) { CTTableStyles tableStyles = styles.getCTStylesheet().getTableStyles(); CTTableStyles thisTableStyles = getCTStylesheet().getTableStyles(); thisTableStyles.setDefaultTableStyle(tableStyles.getDefaultTableStyle()); thisTableStyles.setDefaultPivotStyle(tableStyles.getDefaultPivotStyle()); List<CTTableStyle> newStyles = new ArrayList<CTTableStyle>(); newStyles.addAll(Arrays.asList(thisTableStyles.getTableStyleArray())); for ( CTTableStyle item : tableStyles.getTableStyleArray() ){ boolean exits = false; for(CTTableStyle next: newStyles){ if(next.getName().equals(item.getName())){ exits = true; break; } } if(!exits){ newStyles.add( copyTableElements(styles, item)); } } thisTableStyles.setCount(newStyles.size()); thisTableStyles.setTableStyleArray(newStyles.toArray( new CTTableStyle[newStyles.size()])); }