Example #1
0
        /**
         * Sees if the extended formatting record at the specified position
         * represents a date.  First checks against the built in formats, and
         * then checks against the hash map of FormatRecords
         *
         * @param pos the xf format index
         * @return TRUE if this format index is formatted as a Date
         */
        public bool isDate(int pos)
        {
            XFRecord xfr = (XFRecord)xfRecords[pos];

            if (xfr.isDate())
            {
                return(true);
            }

            if (!formats.ContainsKey(xfr.getFormatRecord()))
            {
                return(false);
            }
            FormatRecord fmt = formats[xfr.getFormatRecord()] as FormatRecord;

            if (fmt == null)
            {
                return(false);
            }
            return(fmt.isDate());
        }
Example #2
0
        /**
         * Gets the DateFormat used to format the cell.
         *
         * @param pos the xf format index
         * @return the DateFormat object used to format the date in the original
         *     excel cell
         */
        public CSharpJExcel.Interop.DateFormat getDateFormat(int pos)
        {
            XFRecord xfr = (XFRecord)xfRecords[pos];

            if (xfr.isDate())
            {
                return(xfr.getDateFormat());
            }

            if (!formats.ContainsKey(xfr.getFormatRecord()))
            {
                return(null);
            }
            FormatRecord fr = formats[xfr.getFormatRecord()] as FormatRecord;

            if (fr == null)
            {
                return(null);
            }

            return(fr.isDate() ? fr.getDateFormat() : null);
        }