コード例 #1
0
        /**
         * Returns the formatter object implied by the format specification for the
         * format part.
         *
         * @param matcher The matcher for the format part.
         *
         * @return The formatter.
         */
        private CellFormatter GetFormatter(Match matcher)
        {
            String fdesc = matcher.Groups[(SPECIFICATION_GROUP)].Value;

            //CellFormatType type = formatType(fdesc);
            return(type.Formatter(fdesc));
        }
コード例 #2
0
        /**
         * Returns the formatter object implied by the format specification for the
         * format part.
         *
         * @param matcher The matcher for the format part.
         *
         * @return The formatter.
         */
        private CellFormatter GetFormatter(Match matcher)
        {
            String fdesc = matcher.Groups[(SPECIFICATION_GROUP)].Value;
            // For now, we don't support localised currencies, so simplify if there
            Match currencyM = CURRENCY_PAT.Match(fdesc);

            if (currencyM.Success)
            {
                String currencyPart = currencyM.Groups[(1)].Value;
                String currencyRepl;
                if (currencyPart.StartsWith("[$-"))
                {
                    // Default $ in a different locale
                    currencyRepl = "$";
                }
                else
                {
                    currencyRepl = currencyPart.Substring(2, currencyPart.LastIndexOf('-') - 2);
                }
                fdesc = fdesc.Replace(currencyPart, currencyRepl);
            }

            // Build a formatter for this simplified string
            return(type.Formatter(fdesc));
        }