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); }