Enum Class ExcelDataType

java.lang.Object
java.lang.Enum<ExcelDataType>
io.github.dornol.excelkit.excel.ExcelDataType
All Implemented Interfaces:
Serializable, Comparable<ExcelDataType>, Constable

public enum ExcelDataType extends Enum<ExcelDataType>
Enum representing supported Excel cell data types.

Each type defines how to write a specific Java type into an Excel cell and optionally provides a default number/date format for styling.

This enum is used to simplify type-safe column setup in ExcelColumn.

Since:
2025-07-19
  • Enum Constant Details

    • STRING

      public static final ExcelDataType STRING
      Generic string type. Calls String.valueOf(value).
    • BOOLEAN_TO_YN

      public static final ExcelDataType BOOLEAN_TO_YN
      Boolean values are converted to "Y" or "N".
    • LONG

      public static final ExcelDataType LONG
      Long integer value.
    • INTEGER

      public static final ExcelDataType INTEGER
      Integer value.
    • DOUBLE

      public static final ExcelDataType DOUBLE
      Double value with 2 decimal places.
    • FLOAT

      public static final ExcelDataType FLOAT
      Float value with 2 decimal places.
    • DOUBLE_PERCENT

      public static final ExcelDataType DOUBLE_PERCENT
      Double value interpreted as a percentage (e.g. 0.25 → 25%).
    • FLOAT_PERCENT

      public static final ExcelDataType FLOAT_PERCENT
      Float value interpreted as a percentage.
    • DATETIME

      public static final ExcelDataType DATETIME
      LocalDateTime formatted as "yyyy-MM-dd HH:mm:ss".
    • DATE

      public static final ExcelDataType DATE
      LocalDate formatted as "yyyy-MM-dd".
    • TIME

      public static final ExcelDataType TIME
      LocalTime formatted as "HH:mm:ss".
    • BIG_DECIMAL_TO_DOUBLE

      public static final ExcelDataType BIG_DECIMAL_TO_DOUBLE
      BigDecimal converted to double (2 decimal places).
    • BIG_DECIMAL_TO_LONG

      public static final ExcelDataType BIG_DECIMAL_TO_LONG
      BigDecimal converted to long (no decimal).
    • FORMULA

      public static final ExcelDataType FORMULA
      Formula type. The value is treated as an Excel formula string (without leading '=').

      Example: "SUM(A2:A100)" or "AVERAGE(B2:B50)"

      Security warning: Do not pass untrusted user input as formula values. DDE formulas (e.g., cmd|'/c calc') can execute arbitrary commands when the Excel file is opened. Always use hardcoded or validated formula strings.

      Note: No runtime guard is applied here because DDE pipe syntax is used by legitimate integrations (e.g., Bloomberg Bloomberg|'USDKRW Curncy'!Last, Reuters). Blocking pipe characters would break these use cases. Input validation is the caller's responsibility.

    • IMAGE

      public static final ExcelDataType IMAGE
      Image type. Embeds an image in the cell.

      Accepts an ExcelImage instance containing the image bytes and type. The image is anchored to the cell and auto-sized.

    • RICH_TEXT

      public static final ExcelDataType RICH_TEXT
      Rich text type. Creates a cell with mixed formatting (partial bold, italic, colors, etc.).

      Accepts an ExcelRichText instance built using its fluent API. If the value is not an ExcelRichText, it falls back to String.valueOf(value).

  • Method Details

    • values

      public static ExcelDataType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ExcelDataType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null