Beispiel #1
0
 public XLNumberFormat(IXLStylized container, IXLNumberFormat defaultNumberFormat)
 {
     _container = container;
     if (defaultNumberFormat == null) return;
     _numberFormatId = defaultNumberFormat.NumberFormatId;
     _format = defaultNumberFormat.Format;
 }
        public bool Equals(IXLNumberFormat other)
        {
            var otherNf = other as XLNumberFormat;

            return
                _numberFormatId == otherNf._numberFormatId
                && _format == otherNf._format
                ;
        }
Beispiel #3
0
        public bool Equals(IXLNumberFormat other)
        {
            var otherNf = other as XLNumberFormat;

            return
                (_numberFormatId == otherNf._numberFormatId &&
                 _format == otherNf._format
                );
        }
Beispiel #4
0
 public XLNumberFormat(IXLStylized container, IXLNumberFormat defaultNumberFormat)
 {
     _container = container;
     if (defaultNumberFormat == null)
     {
         return;
     }
     _numberFormatId = defaultNumberFormat.NumberFormatId;
     _format         = defaultNumberFormat.Format;
 }
        internal static XLNumberFormatKey GenerateKey(IXLNumberFormat defaultNumberFormat)
        {
            if (defaultNumberFormat == null)
            {
                return(XLNumberFormatValue.Default.Key);
            }

            if (defaultNumberFormat is XLNumberFormat)
            {
                return((defaultNumberFormat as XLNumberFormat).Key);
            }

            return(new XLNumberFormatKey
            {
                NumberFormatId = defaultNumberFormat.NumberFormatId,
                Format = defaultNumberFormat.Format
            });
        }
        private static bool NumberFormatsAreEqual(NumberingFormat nf, IXLNumberFormat xlNumberFormat)
        {
            var newXLNumberFormat = new XLNumberFormat();

            if (nf.FormatCode != null && !XLHelper.IsNullOrWhiteSpace(nf.FormatCode.Value))
                newXLNumberFormat.Format = nf.FormatCode.Value;
            else if (nf.NumberFormatId != null)
                newXLNumberFormat.NumberFormatId = (Int32)nf.NumberFormatId.Value;

            return newXLNumberFormat.Equals(xlNumberFormat);
        }
 public XLNumberFormat(XLStyle style = null, IXLNumberFormat d = null) : this(style, GenerateKey(d))
 {
 }