示例#1
0
        public IXLConditionalFormat CopyTo(IXLWorksheet targetSheet)
        {
            if (targetSheet == Range?.Worksheet)
            {
                throw new InvalidOperationException("Cannot copy conditional format to the worksheet it already belongs to.");
            }
            var targetRanges = Ranges.Select(r => targetSheet.Range(((XLRangeAddress)r.RangeAddress).WithoutWorksheet()));
            var newCf        = new XLConditionalFormat(this, targetRanges);

            targetSheet.ConditionalFormats.Add(newCf);
            return(newCf);
        }
        public XLConditionalFormat(XLConditionalFormat other)
        {
            Range            = other.Range;
            Style            = new XLStyle(this, other.Style);
            Values           = new XLDictionary <XLFormula>(other.Values);
            Colors           = new XLDictionary <XLColor>(other.Colors);
            ContentTypes     = new XLDictionary <XLCFContentType>(other.ContentTypes);
            IconSetOperators = new XLDictionary <XLCFIconSetOperator>(other.IconSetOperators);


            ConditionalFormatType = other.ConditionalFormatType;
            TimePeriod            = other.TimePeriod;
            IconSetStyle          = other.IconSetStyle;
            Operator         = other.Operator;
            Bottom           = other.Bottom;
            Percent          = other.Percent;
            ReverseIconOrder = other.ReverseIconOrder;
            ShowIconOnly     = other.ShowIconOnly;
            ShowBarOnly      = other.ShowBarOnly;
        }
示例#3
0
        public XLConditionalFormat(XLConditionalFormat conditionalFormat)
        {
            Id               = Guid.NewGuid();
            Range            = conditionalFormat.Range;
            Style            = new XLStyle(this, conditionalFormat.Style);
            Values           = new XLDictionary <XLFormula>(conditionalFormat.Values);
            Colors           = new XLDictionary <XLColor>(conditionalFormat.Colors);
            ContentTypes     = new XLDictionary <XLCFContentType>(conditionalFormat.ContentTypes);
            IconSetOperators = new XLDictionary <XLCFIconSetOperator>(conditionalFormat.IconSetOperators);


            ConditionalFormatType = conditionalFormat.ConditionalFormatType;
            TimePeriod            = conditionalFormat.TimePeriod;
            IconSetStyle          = conditionalFormat.IconSetStyle;
            Operator           = conditionalFormat.Operator;
            Bottom             = conditionalFormat.Bottom;
            Percent            = conditionalFormat.Percent;
            ReverseIconOrder   = conditionalFormat.ReverseIconOrder;
            ShowIconOnly       = conditionalFormat.ShowIconOnly;
            ShowBarOnly        = conditionalFormat.ShowBarOnly;
            StopIfTrueInternal = OpenXmlHelper.GetBooleanValueAsBool(conditionalFormat.StopIfTrueInternal, true);
        }
示例#4
0
 public XLCFColorScaleMid(XLConditionalFormat conditionalFormat)
 {
     _conditionalFormat = conditionalFormat;
 }
示例#5
0
 public XLCFDataBarMin(XLConditionalFormat conditionalFormat)
 {
     _conditionalFormat = conditionalFormat;
 }
示例#6
0
 public XLConditionalFormat(XLConditionalFormat conditionalFormat, IEnumerable <IXLRange> targetRanges)
     : this(conditionalFormat.StyleValue)
 {
     targetRanges?.ForEach(range => Ranges.Add(range));
     CopyFrom(conditionalFormat);
 }
示例#7
0
 public XLConditionalFormat(XLConditionalFormat conditionalFormat, IXLRange targetRange)
     : this(conditionalFormat, new[] { targetRange })
 {
 }
示例#8
0
 public XLCFIconSet(XLConditionalFormat conditionalFormat)
 {
     _conditionalFormat = conditionalFormat;
 }