internal void FromIconSet(IconSet ics) { this.SetAllNull(); if (ics.IconSetValue != null) { this.IconSetType = SLIconSet.TranslateIconSetToInternalSet(ics.IconSetValue.Value); } if (ics.ShowValue != null) { this.ShowValue = ics.ShowValue.Value; } if (ics.Percent != null) { this.Percent = ics.Percent.Value; } if (ics.Reverse != null) { this.Reverse = ics.Reverse.Value; } using (OpenXmlReader oxr = OpenXmlReader.Create(ics)) { SLConditionalFormatValueObject cfvo; while (oxr.Read()) { if (oxr.ElementType == typeof(ConditionalFormatValueObject)) { cfvo = new SLConditionalFormatValueObject(); cfvo.FromConditionalFormatValueObject((ConditionalFormatValueObject)oxr.LoadCurrentElement()); this.Cfvos.Add(cfvo); } } } }
internal void FromColorScale(ColorScale cs) { this.SetAllNull(); SLConditionalFormatValueObject cfvo; SLColor clr; using (OpenXmlReader oxr = OpenXmlReader.Create(cs)) { while (oxr.Read()) { if (oxr.ElementType == typeof(ConditionalFormatValueObject)) { cfvo = new SLConditionalFormatValueObject(); cfvo.FromConditionalFormatValueObject((ConditionalFormatValueObject)oxr.LoadCurrentElement()); this.Cfvos.Add(cfvo); } else if (oxr.ElementType == typeof(Color)) { clr = new SLColor(new List <System.Drawing.Color>(), new List <System.Drawing.Color>()); clr.FromSpreadsheetColor((Color)oxr.LoadCurrentElement()); this.Colors.Add(clr); } } } }
internal void FromDataBar(DataBar db) { this.SetAllNull(); using (OpenXmlReader oxr = OpenXmlReader.Create(db)) { int i = 0; SLConditionalFormatValueObject cfvo; while (oxr.Read()) { if (oxr.ElementType == typeof(ConditionalFormatValueObject)) { if (i == 0) { cfvo = new SLConditionalFormatValueObject(); cfvo.FromConditionalFormatValueObject((ConditionalFormatValueObject)oxr.LoadCurrentElement()); this.MinimumType = this.TranslateToAutoMinMaxValues(cfvo.Type); this.MinimumValue = cfvo.Val; ++i; } else if (i == 1) { cfvo = new SLConditionalFormatValueObject(); cfvo.FromConditionalFormatValueObject((ConditionalFormatValueObject)oxr.LoadCurrentElement()); this.MaximumType = this.TranslateToAutoMinMaxValues(cfvo.Type); this.MaximumValue = cfvo.Val; ++i; } } else if (oxr.ElementType == typeof(Color)) { this.Color.FromSpreadsheetColor((Color)oxr.LoadCurrentElement()); } } } if (db.MinLength != null) { this.MinLength = db.MinLength.Value; } if (db.MaxLength != null) { this.MaxLength = db.MaxLength.Value; } if (db.ShowValue != null) { this.ShowValue = db.ShowValue.Value; } }