Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        public static string ConvertCString(Cell Value)
        {
            if (Value.IsNull)
            {
                return(Cell.NULL_STRING_TEXT);
            }

            switch (Value.Affinity)
            {
            case CellAffinity.BYTE:
                return(Value.BYTE.ToString());

            case CellAffinity.SHORT:
                return(Value.SHORT.ToString());

            case CellAffinity.INT:
                return(Value.INT.ToString());

            case CellAffinity.LONG:
                return(Value.LONG.ToString());

            case CellAffinity.SINGLE:
                return(Math.Round(Value.SINGLE, Cell.NUMERIC_ROUNDER).ToString());

            case CellAffinity.DOUBLE:
                return(Math.Round(Value.DOUBLE, Cell.NUMERIC_ROUNDER).ToString());

            case CellAffinity.BOOL:
                return(Value.BOOL ? Cell.TRUE_STRING : Cell.FALSE_STRING);

            case CellAffinity.DATE_TIME:
                return(CellFormater.ToShortDate(Value.DATE));

            case CellAffinity.BSTRING:
                return(Value.BSTRING.ToString());

            case CellAffinity.CSTRING:
                return(Value.CSTRING);

            case CellAffinity.BINARY:
                return(Cell.HEX_LITERARL + BitConverter.ToString(Value.BINARY).Replace("-", ""));

            case CellAffinity.ARRAY:
                return(ArrayStringBuilder(Value.ARRAY));

            case CellAffinity.TREF:
                return(Value.valueTREF);

            default:
                return("");
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        public static BString ConvertBString(Cell Value)
        {
            if (Value.IsNull)
            {
                return(new BString(Cell.NULL_STRING_TEXT));
            }

            switch (Value.Affinity)
            {
            case CellAffinity.BYTE:
                return(new BString(Value.BYTE.ToString()));

            case CellAffinity.SHORT:
                return(new BString(Value.SHORT.ToString()));

            case CellAffinity.INT:
                return(new BString(Value.INT.ToString()));

            case CellAffinity.LONG:
                return(new BString(Value.LONG.ToString()));

            case CellAffinity.SINGLE:
                return(new BString(Math.Round(Value.SINGLE, Cell.NUMERIC_ROUNDER).ToString()));

            case CellAffinity.DOUBLE:
                return(new BString(Math.Round(Value.DOUBLE, Cell.NUMERIC_ROUNDER).ToString()));

            case CellAffinity.BOOL:
                return(new BString(Value.BOOL ? Cell.TRUE_STRING : Cell.FALSE_STRING));

            case CellAffinity.DATE_TIME:
                return(new BString(CellFormater.ToLongDate(Value.DATE)));

            case CellAffinity.BSTRING:
                return(Value.BSTRING);

            case CellAffinity.CSTRING:
                return(new BString(Value.CSTRING));

            case CellAffinity.BINARY:
                return(new BString(Cell.HEX_LITERARL + BitConverter.ToString(Value.BINARY).Replace("-", "")));

            default:
                return(BString.Empty);
            }
        }