Examples of CellFormat


Examples of org.apache.poi.ss.format.CellFormat

import junit.framework.TestCase;

public class TestCellFormat extends TestCase {
    public void testSome() {
        JLabel l = new JLabel();
        CellFormat fmt = CellFormat.getInstance(
                "\"$\"#,##0.00_);[Red]\\(\"$\"#,##0.00\\)");
        fmt.apply(l, 1.1);
    }
View Full Code Here

Examples of org.apache.poi.ss.format.CellFormat

                    if (cell != null) {
                        style = cell.getCellStyle();
                        attrs = tagStyle(cell, style);
                        //Set the value that is rendered for the cell
                        //also applies the format
                        CellFormat cf = CellFormat.getInstance(
                                style.getDataFormatString());
                        CellFormatResult result = cf.apply(cell);
                        content = result.text;
                        if (content.equals(""))
                            content = " ";
                    }
                }
View Full Code Here

Examples of org.projectforge.excel.CellFormat

    @Override
    public MyContentProvider updateRowStyle(final ExportRow row)
    {
      for (final ExportCell cell : row.getCells()) {
        final CellFormat format = cell.ensureAndGetCellFormat();
        format.setFillForegroundColor(HSSFColor.WHITE.index);
        switch (row.getRowNum()) {
          case 0:
            format.setFont(FONT_HEADER);
            break;
          case 1:
            format.setFont(FONT_NORMAL_BOLD);
            // alignment = CellStyle.ALIGN_CENTER;
            break;
          default:
            format.setFont(FONT_NORMAL);
            if (row.getRowNum() % 2 == 0) {
              format.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
            }
            break;
        }
      }
      return this;
View Full Code Here

Examples of org.projectforge.excel.CellFormat

    @Override
    public MyContentProvider updateRowStyle(final ExportRow row)
    {
      for (final ExportCell cell : row.getCells()) {
        final CellFormat format = cell.ensureAndGetCellFormat();
        format.setFillForegroundColor(HSSFColor.WHITE.index);
        switch (row.getRowNum()) {
          case 0:
            format.setFont(FONT_HEADER);
            break;
          case 1:
            format.setFont(FONT_NORMAL_BOLD);
            // alignment = CellStyle.ALIGN_CENTER;
            break;
          default:
            format.setFont(FONT_NORMAL);
            if (row.getRowNum() % 2 == 0) {
              format.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
            }
            break;
        }
      }
      return this;
View Full Code Here

Examples of org.projectforge.excel.CellFormat

    @Override
    public MyContentProvider updateRowStyle(final ExportRow row)
    {
      for (final ExportCell cell : row.getCells()) {
        final CellFormat format = cell.ensureAndGetCellFormat();
        format.setFillForegroundColor(HSSFColor.WHITE.index);
        switch (row.getRowNum()) {
          case 0:
            format.setFont(FONT_NORMAL_BOLD);
            // alignment = CellStyle.ALIGN_CENTER;
            break;
          default:
            format.setFont(FONT_NORMAL);
            if (row.getRowNum() % 2 == 0) {
              format.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
            }
            break;
        }
      }
      return this;
View Full Code Here

Examples of org.projectforge.excel.CellFormat

  }

  public MyXlsContentProvider(final ExportWorkbook workbook)
  {
    super(new MyXlsExportContext(), workbook);
    defaultFormatMap.put(DateHolder.class, new CellFormat("YYYY-MM-DD").setAutoDatePrecision(true)); // format unused.
    defaultFormatMap.put(DayHolder.class, new CellFormat(DateFormats.getExcelFormatString(DateFormatType.DATE)));
  }
View Full Code Here

Examples of org.projectforge.excel.CellFormat

      return null;
    }
    // Find a format dependent on the precision:
    final DatePrecision precision = ((DateHolder) value).getPrecision();
    if (precision == DatePrecision.DAY) {
      return new CellFormat(DateFormats.getExcelFormatString(DateFormatType.DATE));
    } else if (precision == DatePrecision.SECOND) {
      return new CellFormat(DateFormats.getExcelFormatString(DateFormatType.DATE_TIME_SECONDS));
    } else if (precision == DatePrecision.MILLISECOND) {
      return new CellFormat(DateFormats.getExcelFormatString(DateFormatType.DATE_TIME_MILLIS));
    } else {
      // HOUR_OF_DAY, MINUTE, MINUTE_15 or null
      return new CellFormat(DateFormats.getExcelFormatString(DateFormatType.DATE_TIME_MINUTES));
    }
  }
View Full Code Here

Examples of org.projectforge.excel.CellFormat

     */
    @Override
    public MyContentProvider updateRowStyle(final ExportRow row)
    {
      for (final ExportCell cell : row.getCells()) {
        final CellFormat format = cell.ensureAndGetCellFormat();
        format.setFillForegroundColor(HSSFColor.WHITE.index);
        switch (row.getRowNum()) {
          case 0:
            format.setFont(FONT_HEADER);
            break;
          case 1:
            format.setFont(FONT_NORMAL_BOLD);
            format.setFillForegroundColor(HSSFColor.YELLOW.index);
            break;
          default:
            format.setFont(FONT_NORMAL);
            if (row.getRowNum() % 2 == 0) {
              format.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
            }
            break;
        }
      }
      return this;
View Full Code Here

Examples of org.zkoss.poi.ss.format.CellFormat

      if ("General".equalsIgnoreCase(formatStr) || "@".equals(formatStr)) {
        return new FormatTextImpl(cell.getRichStringCellValue());
      }
    }
 
    final CellFormat format = CellFormat.getInstance(formatStr == null ? "" : formatStr, ZssContext.getCurrent().getLocale()); //ZSS-68
    return new FormatTextImpl(format.apply(cell));
  }
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.