/**
  * Constructor, taking in the Java compliant number format
  *
  * @param format the format string
  */
 public NumberFormat(string format)
     : base(format)
 {
     // Verify that the format is valid
     DecimalFormat df = new DecimalFormat(format);
 }
 public DecimalFormat(DecimalFormat Other)
     : this(Other._format)
 {
 }
Exemple #3
0
 public DecimalFormat(DecimalFormat Other)
     : this(Other._format)
 {
 }
        /**
         * Constructs this object from the raw data
         *
         * @param t the raw data
         * @param bt the biff type
         */
        public XFRecord(Record t,WorkbookSettings ws,BiffType bt)
            : base(t)
        {
            biffType = bt;

            byte[] data = getRecord().getData();

            fontIndex = IntegerHelper.getInt(data[0],data[1]);
            formatIndex = IntegerHelper.getInt(data[2],data[3]);
            date = false;
            number = false;

            // Compare against the date formats
            for (int i = 0; i < dateFormats.Length && date == false; i++)
                {
                if (formatIndex == dateFormats[i])
                    {
                    date = true;
                    dateFormat = javaDateFormats[i];
                    }
                }

            // Compare against the number formats
            for (int i = 0; i < numberFormats.Length && number == false; i++)
                {
                if (formatIndex == numberFormats[i])
                    {
                    number = true;
                    DecimalFormat df = new DecimalFormat((DecimalFormat)javaNumberFormats[i]);
            // TODO: CML - need to support DecimalFormatSymbols equivalent -- for now, we use the default from en-us
            //DecimalFormatSymbols symbols = new DecimalFormatSymbols(ws.getLocale());
            //df.setDecimalFormatSymbols(symbols);
                    numberFormat = df;
                    //numberFormat = javaNumberFormats[i];
                    }
                }

            // Initialize the parent format and the type
            int cellAttributes = IntegerHelper.getInt(data[4],data[5]);
            parentFormat = (cellAttributes & 0xfff0) >> 4;

            int formatType = cellAttributes & 0x4;
            xfFormatType = formatType == 0 ? cell : style;
            locked = ((cellAttributes & 0x1) != 0);
            hidden = ((cellAttributes & 0x2) != 0);

            if (xfFormatType == cell &&
                (parentFormat & 0xfff) == 0xfff)
                {
                // Something is screwy with the parent format - set to zero
                parentFormat = 0;
                //logger.warn("Invalid parent format found - ignoring");
                }

            initialized = false;
            read = true;
            formatInfoInitialized = false;
            copied = false;
        }