private String GetQuoted(XLFormula formula)
        {
            String value = formula.Value;
            Double num;
            if ((!Double.TryParse(value, out num) && !formula.IsFormula) && value[0] != '\"' && !value.EndsWith("\""))
                return String.Format("\"{0}\"", value.Replace("\"", "\"\""));

            return value;
        }
        private String GetQuoted(XLFormula formula)
        {
            String value = formula.Value;

            if ((!Double.TryParse(value, out double num) && !formula.IsFormula) && value[0] != '\"' && !value.EndsWith("\""))
            {
                return(String.Format("\"{0}\"", value.Replace("\"", "\"\"")));
            }

            return(value);
        }
Example #3
0
        private String GetQuoted(XLFormula formula)
        {
            String value = formula.Value;

            if (formula.IsFormula ||
                value.StartsWith("\"") && value.EndsWith("\"") ||
                Double.TryParse(value, XLHelper.NumberStyle, XLHelper.ParseCulture, out double num))
            {
                return(value);
            }

            return(String.Format("\"{0}\"", value.Replace("\"", "\"\"")));
        }
Example #4
0
        internal void AdjustFormulas(XLCell baseCell, XLCell targetCell)
        {
            var keys = Values.Keys.ToList();

            foreach (var key in keys)
            {
                if (Values[key] == null || !Values[key].IsFormula)
                {
                    continue;
                }

                var r1c1 = baseCell.GetFormulaR1C1(Values[key].Value);
                Values[key] = new XLFormula {
                    _value = targetCell.GetFormulaA1(r1c1), IsFormula = true
                };
            }
        }
Example #5
0
 public XLFormula(XLFormula defaultFormula)
 {
     _value = defaultFormula._value;
     IsFormula = defaultFormula.IsFormula;
 }
Example #6
0
 public XLFormula(XLFormula defaultFormula)
 {
     _value    = defaultFormula._value;
     IsFormula = defaultFormula.IsFormula;
 }