Package jxl.write

Class NumberFormat

  • All Implemented Interfaces:
    jxl.biff.ByteData, jxl.biff.DisplayFormat, Format

    public class NumberFormat
    extends jxl.write.biff.NumberFormatRecord
    implements jxl.biff.DisplayFormat
    A custom user defined number format, which may be instantiated within user applications in order to present numerical values to the appropriate level of accuracy. The string format used to create a number format adheres to the standard java specification, and JExcelAPI makes the necessary modifications so that it is rendered in Excel as the nearest possible equivalent. Once created, this may be used within a CellFormat object, which in turn is a parameter passed to the constructor of the Number cell
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static jxl.write.biff.NumberFormatRecord.NonValidatingFormat COMPLEX_FORMAT
      Pass in to the constructor to bypass the format validation
      static java.lang.String CURRENCY_DOLLAR
      Constant format string for the US Dollar sign
      static java.lang.String CURRENCY_EURO_PREFIX
      Constant format string for the Euro currency symbol where it precedes the format
      static java.lang.String CURRENCY_EURO_SUFFIX
      Constant format string for the Euro currency symbol where it precedes the format
      static java.lang.String CURRENCY_JAPANESE_YEN
      Constant format string for the Japanese Yen sign
      static java.lang.String CURRENCY_POUND
      Constant format string for the UK pound sign
      static java.lang.String FRACTION_HALVES
      Constant format string for fractions as halves
      static java.lang.String FRACTION_HUNDREDTHS
      Constant format string for fractions as hundredths
      static java.lang.String FRACTION_QUARTERS
      Constant format string for fractions as quarter
      static java.lang.String FRACTION_SIXTEENTHS
      Constant format string for fractions as sixteenths
      static java.lang.String FRACTION_TENTHS
      Constant format string for fractions as tenths
      static java.lang.String FRACTION_THREE_DIGITS
      Constant format string for three digit fractions
      static java.lang.String FRACTIONS_EIGHTHS
      Constant format string for fractions as eighths
      • Fields inherited from class jxl.biff.FormatRecord

        biff7, biff8
    • Constructor Summary

      Constructors 
      Constructor Description
      NumberFormat​(java.lang.String format)
      Constructor, taking in the Java compliant number format
      NumberFormat​(java.lang.String format, jxl.write.biff.NumberFormatRecord.NonValidatingFormat dummy)
      Constructor, taking in the non-Java compliant number format.
    • Method Summary

      • Methods inherited from class jxl.biff.FormatRecord

        equals, getData, getDateFormat, getFormatIndex, getFormatString, getIndexCode, getNumberFormat, hashCode, initialize, isBuiltIn, isDate, isInitialized, isNumber
      • Methods inherited from class jxl.biff.WritableRecordData

        getBytes
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface jxl.biff.DisplayFormat

        getFormatIndex, initialize, isBuiltIn, isInitialized
    • Field Detail

      • COMPLEX_FORMAT

        public static final jxl.write.biff.NumberFormatRecord.NonValidatingFormat COMPLEX_FORMAT
        Pass in to the constructor to bypass the format validation
      • CURRENCY_EURO_PREFIX

        public static final java.lang.String CURRENCY_EURO_PREFIX
        Constant format string for the Euro currency symbol where it precedes the format
        See Also:
        Constant Field Values
      • CURRENCY_EURO_SUFFIX

        public static final java.lang.String CURRENCY_EURO_SUFFIX
        Constant format string for the Euro currency symbol where it precedes the format
        See Also:
        Constant Field Values
      • CURRENCY_POUND

        public static final java.lang.String CURRENCY_POUND
        Constant format string for the UK pound sign
        See Also:
        Constant Field Values
      • CURRENCY_JAPANESE_YEN

        public static final java.lang.String CURRENCY_JAPANESE_YEN
        Constant format string for the Japanese Yen sign
        See Also:
        Constant Field Values
      • CURRENCY_DOLLAR

        public static final java.lang.String CURRENCY_DOLLAR
        Constant format string for the US Dollar sign
        See Also:
        Constant Field Values
      • FRACTION_THREE_DIGITS

        public static final java.lang.String FRACTION_THREE_DIGITS
        Constant format string for three digit fractions
        See Also:
        Constant Field Values
      • FRACTION_HALVES

        public static final java.lang.String FRACTION_HALVES
        Constant format string for fractions as halves
        See Also:
        Constant Field Values
      • FRACTION_QUARTERS

        public static final java.lang.String FRACTION_QUARTERS
        Constant format string for fractions as quarter
        See Also:
        Constant Field Values
      • FRACTIONS_EIGHTHS

        public static final java.lang.String FRACTIONS_EIGHTHS
        Constant format string for fractions as eighths
        See Also:
        Constant Field Values
      • FRACTION_SIXTEENTHS

        public static final java.lang.String FRACTION_SIXTEENTHS
        Constant format string for fractions as sixteenths
        See Also:
        Constant Field Values
      • FRACTION_TENTHS

        public static final java.lang.String FRACTION_TENTHS
        Constant format string for fractions as tenths
        See Also:
        Constant Field Values
      • FRACTION_HUNDREDTHS

        public static final java.lang.String FRACTION_HUNDREDTHS
        Constant format string for fractions as hundredths
        See Also:
        Constant Field Values
    • Constructor Detail

      • NumberFormat

        public NumberFormat​(java.lang.String format)
        Constructor, taking in the Java compliant number format
        Parameters:
        format - the format string
      • NumberFormat

        public NumberFormat​(java.lang.String format,
                            jxl.write.biff.NumberFormatRecord.NonValidatingFormat dummy)
        Constructor, taking in the non-Java compliant number format. This may be used for currencies and more complex custom formats, which will not be subject to the standard validation rules. As there is no validation, there is a resultant risk that the generated Excel file will be corrupt USE THIS CONSTRUCTOR ONLY IF YOU ARE CERTAIN THAT THE NUMBER FORMAT YOU ARE USING IS EXCEL COMPLIANT
        Parameters:
        format - the format string
        dummy - dummy parameter