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; }
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) }); }
private static bool ProtectionsAreEqual(Protection protection, IXLProtection xlProtection) { var p = new XLProtection(); if (protection != null) { if (protection.Locked != null) p.Locked = protection.Locked.Value; if (protection.Hidden != null) p.Hidden = protection.Hidden.Value; } return p.Equals(xlProtection); }