コード例 #1
0
        internal IconSet ToIconSet()
        {
            var ics = new IconSet();

            if (IconSetType != SLIconSetValues.ThreeTrafficLights1)
            {
                ics.IconSetValue = TranslateInternalSetToIconSet(IconSetType);
            }
            if (!ShowValue)
            {
                ics.ShowValue = ShowValue;
            }
            if (!Percent)
            {
                ics.Percent = Percent;
            }
            if (Reverse)
            {
                ics.Reverse = Reverse;
            }

            foreach (var cfvo in Cfvos)
            {
                ics.Append(cfvo.ToConditionalFormatValueObject());
            }

            return(ics);
        }
コード例 #2
0
        internal void FromIconSet(IconSet ics)
        {
            SetAllNull();

            if (ics.IconSetValue != null)
            {
                IconSetType = TranslateIconSetToInternalSet(ics.IconSetValue.Value);
            }
            if (ics.ShowValue != null)
            {
                ShowValue = ics.ShowValue.Value;
            }
            if (ics.Percent != null)
            {
                Percent = ics.Percent.Value;
            }
            if (ics.Reverse != null)
            {
                Reverse = ics.Reverse.Value;
            }

            using (var oxr = OpenXmlReader.Create(ics))
            {
                SLConditionalFormatValueObject cfvo;
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(ConditionalFormatValueObject))
                    {
                        cfvo = new SLConditionalFormatValueObject();
                        cfvo.FromConditionalFormatValueObject((ConditionalFormatValueObject)oxr.LoadCurrentElement());
                        Cfvos.Add(cfvo);
                    }
                }
            }
        }