internal SLDataBar2010 Clone() { var db = new SLDataBar2010(); db.Cfvo1 = Cfvo1.Clone(); db.Cfvo2 = Cfvo2.Clone(); db.FillColor = FillColor.Clone(); db.BorderColor = BorderColor.Clone(); db.NegativeFillColor = NegativeFillColor.Clone(); db.NegativeBorderColor = NegativeBorderColor.Clone(); db.AxisColor = AxisColor.Clone(); db.MinLength = MinLength; db.MaxLength = MaxLength; db.ShowValue = ShowValue; db.Border = Border; db.Gradient = Gradient; db.Direction = Direction; db.NegativeBarColorSameAsPositive = NegativeBarColorSameAsPositive; db.NegativeBarBorderColorSameAsPositive = NegativeBarBorderColorSameAsPositive; db.AxisPosition = AxisPosition; return(db); }
internal void FromDataBar(X14.DataBar db) { SetAllNull(); using (var oxr = OpenXmlReader.Create(db)) { var i = 0; while (oxr.Read()) { if (oxr.ElementType == typeof(X14.ConditionalFormattingValueObject)) { if (i == 0) { Cfvo1.FromConditionalFormattingValueObject( (X14.ConditionalFormattingValueObject)oxr.LoadCurrentElement()); ++i; } else if (i == 1) { Cfvo2.FromConditionalFormattingValueObject( (X14.ConditionalFormattingValueObject)oxr.LoadCurrentElement()); ++i; } } else if (oxr.ElementType == typeof(X14.FillColor)) { FillColor.FromFillColor((X14.FillColor)oxr.LoadCurrentElement()); } else if (oxr.ElementType == typeof(X14.BorderColor)) { BorderColor.FromBorderColor((X14.BorderColor)oxr.LoadCurrentElement()); } else if (oxr.ElementType == typeof(X14.NegativeFillColor)) { NegativeFillColor.FromNegativeFillColor((X14.NegativeFillColor)oxr.LoadCurrentElement()); } else if (oxr.ElementType == typeof(X14.NegativeBorderColor)) { NegativeBorderColor.FromNegativeBorderColor((X14.NegativeBorderColor)oxr.LoadCurrentElement()); } else if (oxr.ElementType == typeof(X14.BarAxisColor)) { AxisColor.FromBarAxisColor((X14.BarAxisColor)oxr.LoadCurrentElement()); } } } if (db.MinLength != null) { MinLength = db.MinLength.Value; } if (db.MaxLength != null) { MaxLength = db.MaxLength.Value; } if (db.ShowValue != null) { ShowValue = db.ShowValue.Value; } if (db.Border != null) { Border = db.Border.Value; } if (db.Gradient != null) { Gradient = db.Gradient.Value; } if (db.Direction != null) { Direction = db.Direction.Value; } if (db.NegativeBarColorSameAsPositive != null) { NegativeBarColorSameAsPositive = db.NegativeBarColorSameAsPositive.Value; } if (db.NegativeBarBorderColorSameAsPositive != null) { NegativeBarBorderColorSameAsPositive = db.NegativeBarBorderColorSameAsPositive.Value; } if (db.AxisPosition != null) { AxisPosition = db.AxisPosition.Value; } }
internal X14.DataBar ToDataBar(bool RenderFillColor) { var db = new X14.DataBar(); if (MinLength != 10) { db.MinLength = MinLength; } // according to Open XML specs, this cannot be more than 100 percent. if (MaxLength > 100) { MaxLength = 100; } if (MaxLength != 90) { db.MaxLength = MaxLength; } if (!ShowValue) { db.ShowValue = ShowValue; } if (Border) { db.Border = Border; } if (!Gradient) { db.Gradient = Gradient; } if (Direction != X14.DataBarDirectionValues.Context) { db.Direction = Direction; } if (NegativeBarColorSameAsPositive) { db.NegativeBarColorSameAsPositive = NegativeBarColorSameAsPositive; } if (!NegativeBarBorderColorSameAsPositive) { db.NegativeBarBorderColorSameAsPositive = NegativeBarBorderColorSameAsPositive; } if (AxisPosition != X14.DataBarAxisPositionValues.Automatic) { db.AxisPosition = AxisPosition; } db.Append(Cfvo1.ToConditionalFormattingValueObject()); db.Append(Cfvo2.ToConditionalFormattingValueObject()); // The condition is mainly if the priority of the parent rule exists. See Open XML specs. if (RenderFillColor) { db.Append(FillColor.ToFillColor()); } if (Border) { db.Append(BorderColor.ToBorderColor()); } if (!NegativeBarColorSameAsPositive) { db.Append(NegativeFillColor.ToNegativeFillColor()); } if (!NegativeBarBorderColorSameAsPositive && Border) { db.Append(NegativeBorderColor.ToNegativeBorderColor()); } if (AxisPosition != X14.DataBarAxisPositionValues.None) { db.Append(AxisColor.ToBarAxisColor()); } return(db); }