Class ExcelNumberFormat

java.lang.Object
org.apache.poi.ss.usermodel.ExcelNumberFormat

public class ExcelNumberFormat extends Object
Object to hold a number format index and string, for various formatting evaluations
  • Constructor Details

    • ExcelNumberFormat

      public ExcelNumberFormat(int idx, String format)
      Use this carefully, prefer factory methods to ensure id/format relationships are not broken or confused. Left public so ConditionalFormattingRule.getNumberFormat() implementations can use it.
      Parameters:
      idx - Excel number format index, either a built-in or a higher custom # mapped in the workbook style table
      format - Excel number format string for the index
  • Method Details

    • from

      public static ExcelNumberFormat from(CellStyle style)
      Parameters:
      style -
      Returns:
      null if the style is null, instance from style data format values otherwise
    • from

      public static ExcelNumberFormat from(Cell cell, ConditionalFormattingEvaluator cfEvaluator)
      Parameters:
      cell - cell to extract format from
      cfEvaluator - ConditionalFormattingEvaluator to use, or null if none in this context
      Returns:
      number format from highest-priority rule with a number format, or the cell style, or null if none of the above apply/are defined
    • getIdx

      public int getIdx()
      Returns:
      Excel number format index, either a built-in or a higher custom # mapped in the workbook style table
    • getFormat

      public String getFormat()
      Returns:
      Excel number format string for the index