Examples of HSSFCellStyle


Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

    if (gridCell.getForecolor() != null)
    {
      forecolor = getWorkbookColor(gridCell.getForecolor()).getIndex();
    }

    HSSFCellStyle cellStyle =
      getLoadedCellStyle(
        mode,
        backcolor,
        HSSFCellStyle.ALIGN_LEFT,
        HSSFCellStyle.VERTICAL_TOP,
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

    {
      mode = HSSFCellStyle.SOLID_FOREGROUND;
      backcolor = getWorkbookColor(gridCell.getCellBackcolor()).getIndex();
    }

    HSSFCellStyle cellStyle =
      getLoadedCellStyle(
        mode,
        backcolor,
        HSSFCellStyle.ALIGN_LEFT,
        HSSFCellStyle.VERTICAL_TOP,
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

    {
      mode = HSSFCellStyle.SOLID_FOREGROUND;
      backcolor = getWorkbookColor(gridCell.getCellBackcolor()).getIndex();
    }

    HSSFCellStyle cellStyle =
      getLoadedCellStyle(
        mode,
        backcolor,
        HSSFCellStyle.ALIGN_LEFT,
        HSSFCellStyle.VERTICAL_TOP,
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

                )
              );
         
        }
       
        HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
        cell.setCellType(HSSFCell.CELL_TYPE_FORMULA);
        cell.setCellFormula(formula);
        endCreateCell(cellStyle);
        return;
      }
      catch(Exception e)//FIXMENOW what exceptions could we get here?
      {
        if(log.isWarnEnabled())
        {
          log.warn(e.getMessage());
        }
      }
    }

    if (isDetectCellType)
    {
      TextValue value = getTextValue(textElement, textStr);
      value.handle(new TextValueHandler()
      {
        public void handle(StringTextValue textValue)
        {
          HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
          if (JRCommonText.MARKUP_NONE.equals(textElement.getMarkup()))
          {
            setStringCellValue(textValue.getText());
          }
          else
          {
            setRichTextStringCellValue(styledText, forecolor, textElement, getTextLocale(textElement));
          }
          endCreateCell(cellStyle);
        }

        public void handle(NumberTextValue textValue)
        {
          if (textValue.getPattern() != null)
          {
            baseStyle.setDataFormat(
              dataFormat.getFormat(
                getConvertedPattern(textValue.getPattern())
                )
              );
          }

          HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
          if (textValue.getValue() == null)
          {
            cell.setCellType(HSSFCell.CELL_TYPE_BLANK);
          }
          else
          {
            cell.setCellValue(textValue.getValue().doubleValue());
          }
          endCreateCell(cellStyle);
        }

        public void handle(DateTextValue textValue)
        {
          baseStyle.setDataFormat(
            dataFormat.getFormat(
              getConvertedPattern(textValue.getPattern())
              )
            );
          HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
          if (textValue.getValue() == null)
          {
            cell.setCellType(HSSFCell.CELL_TYPE_BLANK);
          }
          else
          {
            cell.setCellValue(textValue.getValue());
          }
          endCreateCell(cellStyle);
        }

        public void handle(BooleanTextValue textValue)
        {
          HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
          if (textValue.getValue() == null)
          {
            cell.setCellType(HSSFCell.CELL_TYPE_BLANK);
          }
          else
          {
            cell.setCellValue(textValue.getValue().booleanValue());
          }
          endCreateCell(cellStyle);
        }

      });
    }
    else if (isAutoDetectCellType)
    {
      HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
      try
      {
        cell.setCellValue(Double.parseDouble(textStr));
      }
      catch(NumberFormatException e)
      {
        if (JRCommonText.MARKUP_NONE.equals(textElement.getMarkup()))
        {
          setStringCellValue(textStr);
        }
        else
        {
          setRichTextStringCellValue(styledText, forecolor, textElement, getTextLocale(textElement));
        }
      }
      endCreateCell(cellStyle);
    }
    else
    {
      HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
      if (JRCommonText.MARKUP_NONE.equals(textElement.getMarkup()))
      {
        setStringCellValue(textStr);
      }
      else
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

        assertEquals(IndexedColors.AUTOMATIC.getIndex(), style1.getFillBackgroundColor());
        assertNull(style1.getFillBackgroundXSSFColor());

        //compatibility with HSSF
        HSSFWorkbook wb2 = new HSSFWorkbook();
        HSSFCellStyle style2 = wb2.createCellStyle();
        assertEquals(style2.getFillBackgroundColor(), style1.getFillBackgroundColor());
        assertEquals(style2.getFillForegroundColor(), style1.getFillForegroundColor());
        assertEquals(style2.getFillPattern(), style1.getFillPattern());

        assertEquals(style2.getLeftBorderColor(), style1.getLeftBorderColor());
        assertEquals(style2.getTopBorderColor(), style1.getTopBorderColor());
        assertEquals(style2.getRightBorderColor(), style1.getRightBorderColor());
        assertEquals(style2.getBottomBorderColor(), style1.getBottomBorderColor());

        assertEquals(style2.getBorderBottom(), style1.getBorderBottom());
        assertEquals(style2.getBorderLeft(), style1.getBorderLeft());
        assertEquals(style2.getBorderRight(), style1.getBorderRight());
        assertEquals(style2.getBorderTop(), style1.getBorderTop());
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

    // but for now we just ignfore the update
    if(poiCell==null){
      return;
    }
   
    HSSFCellStyle style = getExcelCellStyle(wb);
     
    if(fact.isModified()){
     
      //Set the generic updated style
      poiCell.setCellStyle(style);
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

  /**
   * Get the 'updated' style that we use to show that a cell value has been changed
   * @return
   */
  protected static HSSFCellStyle getExcelCellStyle(HSSFWorkbook wb) {
    HSSFCellStyle style = wb.createCellStyle();
      style.setFillForegroundColor(HSSFColor.ORANGE.index);
      style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
     
      return style;

  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

                String columnName = model.getColumnName(columnIndex);

                HSSFCell cell = headerRow.createCell(columnIndex);
                cell.setCellValue(columnName);

                HSSFCellStyle cellStyle = workbook.createCellStyle();
                HSSFFont tableHeadingFont = workbook.createFont();
                tableHeadingFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
                cellStyle.setFont(tableHeadingFont);
                cell.setCellStyle(cellStyle);
            }
        }

        CellStyleCache cellStyleCache = new CellStyleCache(workbook, model.getProject());
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

    }
    return dayStyle;
  }

  public HSSFCellStyle createDayStyle(final boolean wrapText, final String day) {
    HSSFCellStyle style = wb.createCellStyle();
    style.setWrapText(wrapText);
    style.setBorderBottom((short) 1);
    style.setBorderLeft((short) 1);
    style.setBorderRight((short) 1);
    style.setBorderTop((short) 1);

    if (day != null && day.length() != 0) {
      style.setFillPattern((short) 1);
      short dayColorIndex = DayEnum.getDayColorIndex(day);
      style.setFillBackgroundColor(dayColorIndex);
      style.setFillForegroundColor(dayColorIndex);
    }
    return style;
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

      final short boldStyle, final short backgroundColor, short alignment) {
    HSSFFont font = wb.createFont();
    font.setFontHeightInPoints(headFontSize);
    font.setBoldweight(boldStyle);

    HSSFCellStyle cellStyle = wb.createCellStyle();
    cellStyle.setFont(font);
    cellStyle.setAlignment(alignment);
    cellStyle.setFillBackgroundColor(backgroundColor);
    cellStyle.setFillForegroundColor(backgroundColor);
    cellStyle.setFillPattern((short) 1);
    return cellStyle;
  }
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.