示例#1
0
 /// <summary>
 /// Apply specified style to the container.
 /// </summary>
 /// <param name="value">Style to apply.</param>
 /// <param name="propagate">Whether or not propagate the style to inner ranges.</param>
 private void SetStyle(XLStyleValue value, bool propagate = false)
 {
     StyleValue = value;
     if (propagate)
     {
         Children.ForEach(child => child.SetStyle(StyleValue, true));
     }
 }
示例#2
0
 private XLConditionalFormat(XLStyleValue style)
     : base(XLStyle.Default.Value)
 {
     Id               = Guid.NewGuid();
     Ranges           = new XLRanges();
     Values           = new XLDictionary <XLFormula>();
     Colors           = new XLDictionary <XLColor>();
     ContentTypes     = new XLDictionary <XLCFContentType>();
     IconSetOperators = new XLDictionary <XLCFIconSetOperator>();
 }
示例#3
0
 private void SetStyle(IXLStyle style, bool propagate = false)
 {
     if (style is XLStyle xlStyle)
     {
         SetStyle(xlStyle.Value, propagate);
     }
     else
     {
         SetStyle(XLStyleValue.FromKey(XLStyle.GenerateKey(style)), propagate);
     }
 }
示例#4
0
        void IXLStylized.ModifyStyle(Func <XLStyleKey, XLStyleKey> modification)
        {
            var children = GetChildrenRecursively(this)
                           .GroupBy(child => child.StyleValue, _comparer);

            foreach (var group in children)
            {
                var styleKey   = modification(group.Key.Key);
                var styleValue = XLStyleValue.FromKey(ref styleKey);
                foreach (var child in group)
                {
                    child.StyleValue = styleValue;
                }
            }
        }
示例#5
0
 /// <summary>
 /// To initialize XLStyle.Default only
 /// </summary>
 private XLStyle(XLStyleValue value)
 {
     _container = null;
     Value      = value;
 }
示例#6
0
 internal XLStyle(IXLStylized container, XLStyleValue value)
 {
     _container = container ?? new XLStylizedEmpty(XLStyle.Default);
     Value      = value;
 }
示例#7
0
 public XLStyle(IXLStylized container, XLStyleKey key) : this(container, XLStyleValue.FromKey(key))
 {
 }
示例#8
0
 protected XLStylizedBase(XLStyleValue styleValue = null)
 {
     StyleValue = styleValue ?? XLWorkbook.DefaultStyleValue;
 }
示例#9
0
 /// <summary>
 /// Create a new instance of <see cref="XLColumns"/>.
 /// </summary>
 /// <param name="worksheet">If worksheet is specified it means that the created instance represents
 /// all columns on a worksheet so changing its width will affect all columns.</param>
 /// <param name="defaultStyle">Default style to use when initializing child entries.</param>
 public XLColumns(XLWorksheet worksheet, XLStyleValue defaultStyle = null)
     : base(defaultStyle)
 {
     _worksheet = worksheet;
 }
 protected XLStylizedBase(XLStyleValue styleValue)
 {
     StyleValue = styleValue;
 }