Class FractionFormat
java.lang.Object
java.text.Format
org.xlsx4j.org.apache.poi.ss.usermodel.FractionFormat
- All Implemented Interfaces:
Serializable,Cloneable
Format class that handles Excel style fractions, such as "# #/#" and "#/###"
As of this writing, this is still not 100% accurate, but it does a reasonable job of trying to mimic Excel's fraction calculations. It does not currently maintain Excel's spacing.
This class relies on a method lifted nearly verbatim from org.apache.math.fraction. If further uses for Commons Math are found, we will consider adding it as a dependency. For now, we have in-lined the one method to keep things simple.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.Format
Format.Field -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFractionFormat(String wholePartFormatString, String denomFormatString) Single parameter ctor -
Method Summary
Modifier and TypeMethodDescriptionformat(Object obj, StringBuffer toAppendTo, FieldPosition pos) parseObject(String source, ParsePosition pos) Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
-
Field Details
-
DENOM_FORMAT_PATTERN
-
MAX_DENOM_POW
private static final int MAX_DENOM_POW- See Also:
-
exactDenom
private final int exactDenom -
maxDenom
private final int maxDenom -
wholePartFormatString
-
-
Constructor Details
-
FractionFormat
Single parameter ctor- Parameters:
denomFormatString- The format string for the denominator
-
-
Method Details
-
format
-
format
-
parseObject
- Specified by:
parseObjectin classFormat
-