Examples of cloneStyleFrom()


Examples of org.apache.poi.ss.usermodel.CellStyle.cloneStyleFrom()

    style.cloneStyleFrom(styles.get("data"));
    style.setAlignment(CellStyle.ALIGN_CENTER);
    styles.put("data2", style);

    style = wb.createCellStyle();
    style.cloneStyleFrom(styles.get("data"));
    style.setAlignment(CellStyle.ALIGN_RIGHT);
    styles.put("data3", style);
   
    style = wb.createCellStyle();
    style.cloneStyleFrom(styles.get("data"));
View Full Code Here

Examples of org.apache.poi.ss.usermodel.CellStyle.cloneStyleFrom()

    style.cloneStyleFrom(styles.get("data"));
    style.setAlignment(CellStyle.ALIGN_RIGHT);
    styles.put("data3", style);
   
    style = wb.createCellStyle();
    style.cloneStyleFrom(styles.get("data"));
//    style.setWrapText(true);
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    Font headerFont = wb.createFont();
View Full Code Here

Examples of org.zkoss.poi.ss.usermodel.CellStyle.cloneStyleFrom()

    final short rb = dstStyle.getBorderRight();
    final short bc = dstStyle.getBottomBorderColor();
    final short tc = dstStyle.getTopBorderColor();
    final short lc = dstStyle.getLeftBorderColor();
    final short rc = dstStyle.getRightBorderColor();
    dstStyle.cloneStyleFrom(srcStyle);
    dstStyle.setBorderBottom(bb);
    dstStyle.setBorderTop(tb);
    dstStyle.setBorderLeft(lb);
    dstStyle.setBorderRight(rb);
    dstStyle.setBottomBorderColor(bc);
View Full Code Here

Examples of org.zkoss.poi.ss.usermodel.CellStyle.cloneStyleFrom()

          final CellStyle style = cell != null ? cell.getCellStyle() : null;
          final String oldFormat = style != null ? style.getDataFormatString() : null;
          if (oldFormat == null || "General".equals(oldFormat)) {
            CellStyle newCellStyle = book.createCellStyle();
            if (style != null) {
              newCellStyle.cloneStyleFrom(style);
            }
            BookHelper.setDataFormat(book, newCellStyle, formatString); //prepare a DataFormat with the specified formatString
            BookHelper.setCellStyle(sheet, row, col, row, col, newCellStyle);
          }
        }
View Full Code Here

Examples of org.zkoss.poi.ss.usermodel.CellStyle.cloneStyleFrom()

   * Copy the current cell's style setting, returns a new {@link CellStyle}
   * @return CellStyle
   */
  public CellStyle cloneCellStyle() {
    CellStyle newCellStyle = book.createCellStyle();
    newCellStyle.cloneStyleFrom(getOrCreateCell().getCellStyle());
    return newCellStyle;
  }
 
  public Font getOrCreateFont(short boldWeight, Color color, short fontHeight, java.lang.String name,
      boolean italic, boolean strikeout, short typeOffset, byte underline) {
View Full Code Here

Examples of org.zkoss.poi.ss.usermodel.CellStyle.cloneStyleFrom()

        final Color srcColor = cs.getFillForegroundColorColor();
        if (Objects.equals(srcColor, bsColor)) {
          continue;
        }
        CellStyle newCellStyle = book.createCellStyle();
        newCellStyle.cloneStyleFrom(cs);
       
        //bug#ZSS-34: cell background color does not show in excel
        //20110819, henrichen@zkoss.org: set color to a cell shall change its fillPattern to "solid" automatically
        final short patternType = cs.getFillPattern();
        if (patternType == CellStyle.NO_FILL) {
View Full Code Here

Examples of org.zkoss.poi.ss.usermodel.CellStyle.cloneStyleFrom()

public class Styles {
  private static final Log log = Log.lookup(Styles.class);
 
  public static CellStyle cloneCellStyle(Cell cell) {
    final CellStyle destination = cell.getSheet().getWorkbook().createCellStyle();
    destination.cloneStyleFrom(cell.getCellStyle());
    return destination;
  }
 
  public static void setFontColor(Worksheet sheet, int row, int col, String color){
    final Cell cell = Utils.getOrCreateCell(sheet,row,col);
View Full Code Here

Examples of org.zkoss.poi.ss.usermodel.CellStyle.cloneStyleFrom()

  public void testSetBgColor() {
    Worksheet sheet1 = _workbook.getWorksheet("Sheet1");
    Row row1 = sheet1.getRow(0);
    Cell A1 = BookHelper.getOrCreateCell(sheet1, 0, 0);
    CellStyle newCellStyle = _workbook.createCellStyle();
    newCellStyle.cloneStyleFrom(A1.getCellStyle());
    final Color bsColor = BookHelper.HTMLToColor(_workbook, "#00FF00");
    BookHelper.setFillForegroundColor(newCellStyle, bsColor);
    BookHelper.setCellStyle(sheet1, 0, 0, 0, 0, newCellStyle);
    assertEquals("FF00FF00", ((XSSFColor)row1.getCell(0).getCellStyle().getFillForegroundColorColor()).getARGBHex()); //A1: Green
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.