public class CellFormatPart
extends java.lang.Object
Each format part can contain a color, a condition, and will always contain a format specification. For example "[Red][>=10]#" has a color ([Red]), a condition (>=10) and a format specification (#).
This class also contains patterns for matching the subparts of format specification. These are used internally, but are made public in case other code has use for them.
(此类的对象表示单元格格式表达式的单个部分。每个单元格最多可以有四个用于正值、零值、负值和文本值。每个格式部分都可以包含颜色、条件,并且始终包含格式规范。例如,“[Red][>=10]#”具有颜色 ([Red])、条件 (>=10) 和格式规范 (#)。此类还包含用于匹配格式规范的子部分的模式。这些在内部使用,但在其他代码使用时会公开。)Modifier and Type | Field and Description |
---|---|
static int |
COLOR_GROUP
Within
FORMAT_PAT , the group number for the matched color.
(在 FORMAT_PAT 中,匹配颜色的组号。)
|
static java.util.regex.Pattern |
COLOR_PAT
Pattern for the color part of a cell format part.
(单元格格式部分的颜色部分的图案。)
|
static int |
CONDITION_OPERATOR_GROUP
Within
FORMAT_PAT , the group number for the operator in the condition.
(在 FORMAT_PAT 中,条件中运算符的组号。)
|
static java.util.regex.Pattern |
CONDITION_PAT
Pattern for the condition part of a cell format part.
(单元格格式部分的条件部分的模式。)
|
static int |
CONDITION_VALUE_GROUP
Within
FORMAT_PAT , the group number for the value in the condition.
(在 FORMAT_PAT 中,条件中的值的组号。)
|
static java.util.regex.Pattern |
CURRENCY_PAT
Pattern for the currency symbol part of a cell format part
(单元格格式部分的货币符号部分的模式)
|
static java.util.regex.Pattern |
FORMAT_PAT
Pattern for an entire cell single part.
(整个单元格单个部分的图案。)
|
static int |
SPECIFICATION_GROUP
Within
FORMAT_PAT , the group number for the format specification.
(在 FORMAT_PAT 中,格式规范的组号。)
|
static java.util.regex.Pattern |
SPECIFICATION_PAT
Pattern for the format specification part of a cell format part.
(单元格格式部分的格式规范部分的模式。)
|
Constructor and Description |
---|
CellFormatPart(java.util.Locale locale, java.lang.String desc)
Create an object to represent a format part.
|
CellFormatPart(java.lang.String desc)
Create an object to represent a format part.
|
Modifier and Type | Method and Description |
---|---|
boolean |
applies(java.lang.Object valueObject)
Returns
true if this format part applies to the given value.
(如果此格式部分适用于给定值,则返回 true。)
|
CellFormatResult |
apply(javax.swing.JLabel label, java.lang.Object value)
Apply this format part to the given value, applying the result to the given label.
(将此格式部分应用于给定值,将结果应用于给定标签。)
|
CellFormatResult |
apply(java.lang.Object value)
Apply this format part to the given value.
(将此格式部分应用于给定值。)
|
static java.lang.String |
group(java.util.regex.Matcher m, int g)
Returns the string from the group, or
"" if the group is
null.
(返回组中的字符串,如果组为空,则返回“”。)
|
static java.lang.StringBuffer |
parseFormat(java.lang.String fdesc, CellFormatType type, org.apache.poi.ss.format.CellFormatPart.PartHandler partHandler) |
java.lang.String |
toString() |
public static final java.util.regex.Pattern COLOR_PAT
public static final java.util.regex.Pattern CONDITION_PAT
public static final java.util.regex.Pattern SPECIFICATION_PAT
public static final java.util.regex.Pattern CURRENCY_PAT
public static final java.util.regex.Pattern FORMAT_PAT
public static final int COLOR_GROUP
FORMAT_PAT
, the group number for the matched color.
(在 FORMAT_PAT 中,匹配颜色的组号。)
public static final int CONDITION_OPERATOR_GROUP
FORMAT_PAT
, the group number for the operator in the condition.
(在 FORMAT_PAT 中,条件中运算符的组号。)
public static final int CONDITION_VALUE_GROUP
FORMAT_PAT
, the group number for the value in the condition.
(在 FORMAT_PAT 中,条件中的值的组号。)
public static final int SPECIFICATION_GROUP
FORMAT_PAT
, the group number for the format specification.
(在 FORMAT_PAT 中,格式规范的组号。)
public CellFormatPart(java.lang.String desc)
desc
- The string to parse.
(desc - 要解析的字符串。)
public CellFormatPart(java.util.Locale locale, java.lang.String desc)
locale
- The locale to use.
(locale - 要使用的语言环境。)
desc
- The string to parse.
(desc - 要解析的字符串。)
public boolean applies(java.lang.Object valueObject)
valueObject
- The value to evaluate.
(valueObject - 要评估的值。)
public CellFormatResult apply(java.lang.Object value)
CellFormatResult
object with the results.
(将此格式部分应用于给定值。这将返回带有结果的 CellFormatResult 对象。)
value
- The value to apply this format part to.
(value - 应用此格式部分的值。)
CellFormatResult
object containing the results of applying the format to the value.
(一个 CellFormatResult 对象,其中包含将格式应用于值的结果。)
public CellFormatResult apply(javax.swing.JLabel label, java.lang.Object value)
label
- The label
(标签 - 标签)
value
- The value to apply this format part to.
(value - 应用此格式部分的值。)
public static java.lang.StringBuffer parseFormat(java.lang.String fdesc, CellFormatType type, org.apache.poi.ss.format.CellFormatPart.PartHandler partHandler)
public static java.lang.String group(java.util.regex.Matcher m, int g)
m
- The matcher.
(m - 匹配器。)
g
- The group number.
(g - 组号。)
public java.lang.String toString()
toString
in class
java.lang.Object
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.