internal void FromConditionalFormatting(ConditionalFormatting cf) { this.SetAllNull(); if (cf.Pivot != null) this.Pivot = cf.Pivot.Value; if (cf.SequenceOfReferences != null) { this.SequenceOfReferences = SLTool.TranslateSeqRefToCellPointRange(cf.SequenceOfReferences); } using (OpenXmlReader oxr = OpenXmlReader.Create(cf)) { SLConditionalFormattingRule cfr; while (oxr.Read()) { if (oxr.ElementType == typeof(ConditionalFormattingRule)) { cfr = new SLConditionalFormattingRule(); cfr.FromConditionalFormattingRule((ConditionalFormattingRule)oxr.LoadCurrentElement()); this.Rules.Add(cfr); } } } }
internal void FromConditionalFormatting(ConditionalFormatting cf) { this.SetAllNull(); if (cf.Pivot != null) this.Pivot = cf.Pivot.Value; SLCellPointRange pt; int index; int iStartRowIndex = -1; int iStartColumnIndex = -1; int iEndRowIndex = -1; int iEndColumnIndex = -1; foreach (var s in cf.SequenceOfReferences.Items) { index = s.Value.IndexOf(":"); if (index > -1) { if (SLTool.FormatCellReferenceRangeToRowColumnIndex(s.Value, out iStartRowIndex, out iStartColumnIndex, out iEndRowIndex, out iEndColumnIndex)) { pt = new SLCellPointRange(iStartRowIndex, iStartColumnIndex, iEndRowIndex, iEndColumnIndex); this.SequenceOfReferences.Add(pt); } } else { if (SLTool.FormatCellReferenceToRowColumnIndex(s.Value, out iStartRowIndex, out iStartColumnIndex)) { pt = new SLCellPointRange(iStartRowIndex, iStartColumnIndex, iStartRowIndex, iStartColumnIndex); this.SequenceOfReferences.Add(pt); } } } foreach (var rule in cf.Elements<ConditionalFormattingRule>()) { var cfr = new SLConditionalFormattingRule(); cfr.FromConditionalFormattingRule(rule); this.Rules.Add(cfr); } }