org.apache.poi.ss.usermodel
Class FractionFormat

java.lang.Object  extended by java.text.Format      extended by org.apache.poi.ss.usermodel.FractionFormat
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class FractionFormat
extends java.text.Format

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:
Serialized Form


Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.Format
java.text.Format.Field
 
Constructor Summary
FractionFormat(java.lang.String wholePartFormatString, java.lang.String denomFormatString)
          Single parameter ctor
 
Method Summary
 java.lang.Stringformat(java.lang.Number num)
           
 java.lang.StringBufferformat(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
           
 java.lang.ObjectparseObject(java.lang.String source, java.text.ParsePosition pos)
           
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FractionFormat

public FractionFormat(java.lang.String wholePartFormatString,                      java.lang.String denomFormatString)
Single parameter ctor

Parameters:
denomFormatString - The format string for the denominator

Method Detail

format

public java.lang.String format(java.lang.Number num)

format

public java.lang.StringBuffer format(java.lang.Object obj,                                     java.lang.StringBuffer toAppendTo,                                     java.text.FieldPosition pos)
Specified by:
format in class java.text.Format

parseObject

public java.lang.Object parseObject(java.lang.String source,                                    java.text.ParsePosition pos)
Specified by:
parseObject in class java.text.Format




NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14