public class NumFmt extends Object implements Comparable<NumFmt>
A number format can have up to four sections of code, separated by semicolons. These code sections define the format for positive numbers, negative numbers, zero values, and text, in that order.
<POSITIVE>;<NEGATIVE>;<ZERO>;<TEXT>
For example, you can use these code sections to create the following custom format:
[Blue]#,##0.00_);[Red](#,##0.00);0.00;"sales "@
You do not have to include all code sections in your custom number format. If you specify only two code sections for your custom number format, the first section is used for positive numbers and zeros, and the second section is used for negative numbers. If you specify only one code section, it is used for all numbers. If you want to skip a code section and include a code section that follows it, you must include the ending semicolon for the section that you skip.
| 限定符和类型 | 字段和说明 |
|---|---|
static NumFmt |
DATE_FORMAT
Format as
yyyy-mm-dd hh:mm:ss |
static NumFmt |
DATETIME_FORMAT
Format as
yyyy-mm-dd hh:mm:ss |
static NumFmt |
TIME_FORMAT
Format as
yyyy-mm-dd hh:mm:ss |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
calcNumWidth(int base)
Roughly calculate the cell length
|
int |
compareTo(NumFmt o) |
boolean |
equals(Object o) |
String |
getCode() |
int |
getId() |
int |
hashCode() |
static NumFmt |
of(String code)
Create a NumFmt
|
void |
setCode(String code) |
org.dom4j.Element |
toDom4j(org.dom4j.Element root) |
String |
toString() |
static NumFmt |
valueOf(int id)
Built-In number format
|
public static final NumFmt DATETIME_FORMAT
yyyy-mm-dd hh:mm:sspublic static final NumFmt DATE_FORMAT
yyyy-mm-dd hh:mm:sspublic static final NumFmt TIME_FORMAT
yyyy-mm-dd hh:mm:sspublic NumFmt(String code)
public String getCode()
public void setCode(String code)
public int getId()
public static NumFmt valueOf(int id)
id - the built-in idNumFmtpublic static NumFmt of(String code)
code - the numFmt code stringpublic int calcNumWidth(int base)
base - the cell value lengthpublic org.dom4j.Element toDom4j(org.dom4j.Element root)
public int compareTo(NumFmt o)
compareTo 在接口中 Comparable<NumFmt>Copyright © 2022. All rights reserved.