Enum Class DataFormat

java.lang.Object
java.lang.Enum<DataFormat>
io.leandev.appfuse.workbook.DataFormat
All Implemented Interfaces:
Serializable, Comparable<DataFormat>, Constable

public enum DataFormat extends Enum<DataFormat>

常用儲存格資料格式

每個列舉值對應一個 Excel 格式字串(非 Java 的 DateTimeFormatter 樣式)。 透過 Cell.setDataFormat(DataFormat) 套用,省去手寫 Excel 格式碼。 需要自訂格式時改用 Cell.setDataFormat(String) 直接傳入 Excel 格式字串。

Since:
4.0.0
  • Enum Constant Details

    • TEXT

      public static final DataFormat TEXT
      一般文字(@
    • DATE

      public static final DataFormat DATE
      日期(yyyy-mm-dd
    • DATETIME

      public static final DataFormat DATETIME
      日期時間(yyyy-mm-dd hh:mm:ss
    • TIME

      public static final DataFormat TIME
      時間(hh:mm:ss
    • INTEGER

      public static final DataFormat INTEGER
      整數(千分位,#,##0
    • FLOAT

      public static final DataFormat FLOAT
      浮點數(千分位兩位小數,#,##0.00
    • MONEY

      public static final DataFormat MONEY
      貨幣($#,##0.00
    • PERCENT

      public static final DataFormat PERCENT
      百分比(0.00%
  • Method Details

    • values

      public static DataFormat[] 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 DataFormat 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
    • pattern

      public String pattern()
      取得對應的 Excel 格式字串
      Returns:
      Excel 格式字串