/** * Clones all the style information from another * HSSFCellStyle, onto this one. This * HSSFCellStyle will then have all the same * properties as the source, but the two may * be edited independently. * Any stylings on this HSSFCellStyle will be lost! * * The source HSSFCellStyle could be from another * HSSFWorkbook if you like. This allows you to * copy styles from one HSSFWorkbook to another. */ @Override public void cloneStyleFrom(CellStyle source) { if(source instanceof HSSFCellStyle) { this.cloneStyleFrom((HSSFCellStyle)source); } else { throw new IllegalArgumentException("Can only clone from one HSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle"); } } public void cloneStyleFrom(HSSFCellStyle source) {
newCellStyle.cloneStyleFrom(oldCell.getCellStyle());
HSSFCellStyle newStyle = excelBook1.createCellStyle(); newStyle.cloneStyleFrom(cellStyle1); book2Styles.put(index, newStyle); styleFromMap = newStyle;
HSSFCellStyle newStyle = excelBook1.createCellStyle(); newStyle.cloneStyleFrom(cellStyle1);
/** * Clones all the style information from another * HSSFCellStyle, onto this one. This * HSSFCellStyle will then have all the same * properties as the source, but the two may * be edited independently. * Any stylings on this HSSFCellStyle will be lost! * * The source HSSFCellStyle could be from another * HSSFWorkbook if you like. This allows you to * copy styles from one HSSFWorkbook to another. */ public void cloneStyleFrom(CellStyle source) { if(source instanceof HSSFCellStyle) { this.cloneStyleFrom((HSSFCellStyle)source); } else { throw new IllegalArgumentException("Can only clone from one HSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle"); } } public void cloneStyleFrom(HSSFCellStyle source) {
/** * Clones all the style information from another * HSSFCellStyle, onto this one. This * HSSFCellStyle will then have all the same * properties as the source, but the two may * be edited independently. * Any stylings on this HSSFCellStyle will be lost! * * The source HSSFCellStyle could be from another * HSSFWorkbook if you like. This allows you to * copy styles from one HSSFWorkbook to another. */ public void cloneStyleFrom(CellStyle source) { if(source instanceof HSSFCellStyle) { this.cloneStyleFrom((HSSFCellStyle)source); } else { throw new IllegalArgumentException("Can only clone from one HSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle"); } } public void cloneStyleFrom(HSSFCellStyle source) {
/** * Clones all the style information from another * HSSFCellStyle, onto this one. This * HSSFCellStyle will then have all the same * properties as the source, but the two may * be edited independently. * Any stylings on this HSSFCellStyle will be lost! * * The source HSSFCellStyle could be from another * HSSFWorkbook if you like. This allows you to * copy styles from one HSSFWorkbook to another. */ @Override public void cloneStyleFrom(CellStyle source) { if(source instanceof HSSFCellStyle) { this.cloneStyleFrom((HSSFCellStyle)source); } else { throw new IllegalArgumentException("Can only clone from one HSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle"); } } public void cloneStyleFrom(HSSFCellStyle source) {
styleRed.cloneStyleFrom(styleDefault); styleRed.setFillForegroundColor((short)HSSFColor.RED.index); styleRed.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); styleYellow.cloneStyleFrom(styleDefault); styleYellow.setFillForegroundColor((short)HSSFColor.YELLOW.index); styleYellow.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); styleGreen.cloneStyleFrom(styleDefault); styleGreen.setFillForegroundColor((short)HSSFColor.GREEN.index); styleGreen.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
newCellStyle.cloneStyleFrom(oldCell.getCellStyle());
if(newCellStyle == null){ newCellStyle = newCell.getSheet().getWorkbook().createCellStyle(); newCellStyle.cloneStyleFrom(oldCell.getCellStyle()); styleMap.put(stHashCode, newCellStyle);
newCellStyle.cloneStyleFrom(oldCell.getCellStyle());