Exemplo n.º 1
1
        public XLStyle(IXLStylized container, IXLStyle initialStyle = null, Boolean useDefaultModify = true)
        {
            if (initialStyle != null)
            {
                Font = new XLFont(container, initialStyle.Font, useDefaultModify);
                Alignment = new XLAlignment(container, initialStyle.Alignment);
                Border = new XLBorder(container, initialStyle.Border, useDefaultModify);
                Fill = new XLFill(container, initialStyle.Fill, useDefaultModify);
                NumberFormat = new XLNumberFormat(container, initialStyle.NumberFormat);
                Protection = new XLProtection(container, initialStyle.Protection);
            }
            else
            {
                Font = new XLFont(container, null);
                Alignment = new XLAlignment(container);
                Border = new XLBorder(container, null);
                Fill = new XLFill(container);
                NumberFormat = new XLNumberFormat(container, null);
                Protection = new XLProtection(container);
            }

            DateFormat = NumberFormat;
        }
Exemplo n.º 2
0
        internal static XLStyleKey GenerateKey(IXLStyle initialStyle)
        {
            if (initialStyle == null)
            {
                return(Default.Key);
            }
            if (initialStyle is XLStyle)
            {
                return((initialStyle as XLStyle).Key);
            }

            return(new XLStyleKey
            {
                Font = XLFont.GenerateKey(initialStyle.Font),
                Alignment = XLAlignment.GenerateKey(initialStyle.Alignment),
                Border = XLBorder.GenerateKey(initialStyle.Border),
                Fill = XLFill.GenerateKey(initialStyle.Fill),
                NumberFormat = XLNumberFormat.GenerateKey(initialStyle.NumberFormat),
                Protection = XLProtection.GenerateKey(initialStyle.Protection)
            });
        }
Exemplo n.º 3
0
        public XLStyle(IXLStylized container, IXLStyle initialStyle = null, Boolean useDefaultModify = true)
        {
            if (initialStyle != null)
            {
                Font         = new XLFont(container, initialStyle.Font, useDefaultModify);
                Alignment    = new XLAlignment(container, initialStyle.Alignment);
                Border       = new XLBorder(container, initialStyle.Border, useDefaultModify);
                Fill         = new XLFill(container, initialStyle.Fill, useDefaultModify);
                NumberFormat = new XLNumberFormat(container, initialStyle.NumberFormat);
                Protection   = new XLProtection(container, initialStyle.Protection);
            }
            else
            {
                Font         = new XLFont(container, null);
                Alignment    = new XLAlignment(container);
                Border       = new XLBorder(container, null);
                Fill         = new XLFill(container);
                NumberFormat = new XLNumberFormat(container, null);
                Protection   = new XLProtection(container);
            }

            DateFormat = NumberFormat;
        }
        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);
        }