/// <summary> /// Initializes a new instance of the <see cref="CellFormat"/> class. /// </summary> /// <param name="outerBorders">OPTIONAL borders to apply to the cell, in the order that they should be applied. DEFAULT is no border.</param> /// <param name="backgroundColor">OPTIONAL background color of the cell. DEFAULT is to leave the background color unchanged.</param> /// <param name="fontFormat">OPTIONAL font format. DEFAULT is to leave the font unchanged.</param> /// <param name="verticalAlignment">OPTIONAL vertical alignment. DEFAULT is to leave the vertical alignment unchanged.</param> /// <param name="horizontalAlignment">OPTIONAL horizontal alignment. DEFAULT is to leave the horizontal alignment unchanged.</param> /// <param name="fontRotationAngle">OPTIONAL font rotation angle, between +90 and -90. Positive numbers cause the text to slope upward, negative numbers cause the text to slope downward. DEFAULT is to leave the font rotation angle unchanged.</param> /// <param name="fillPattern">OPTIONAL pattern to fill the cell with. DEFAULT is no pattern.</param> /// <param name="options">OPTIONAL formatting options to apply to the cell. DEFAULT is to not apply any of the formatting options.</param> public CellFormat( IReadOnlyList <OuterBorder> outerBorders = null, FontFormat fontFormat = null, Color?backgroundColor = null, VerticalAlignment?verticalAlignment = null, HorizontalAlignment?horizontalAlignment = null, int?fontRotationAngle = null, FillPattern fillPattern = null, CellFormatOptions?options = null) : base(outerBorders) { if (verticalAlignment == DataStructure.VerticalAlignment.Unknown) { throw new ArgumentOutOfRangeException(Invariant($"{nameof(verticalAlignment)} is {nameof(DataStructure.VerticalAlignment.Unknown)}.")); } if (horizontalAlignment == DataStructure.HorizontalAlignment.Unknown) { throw new ArgumentOutOfRangeException(Invariant($"{nameof(horizontalAlignment)} is {nameof(DataStructure.HorizontalAlignment.Unknown)}.")); } this.FontFormat = fontFormat; this.BackgroundColor = backgroundColor; this.VerticalAlignment = verticalAlignment; this.HorizontalAlignment = horizontalAlignment; this.FontRotationAngle = fontRotationAngle; this.FillPattern = fillPattern; this.Options = options; }
public CellFormat DeepCloneWithFontFormat(FontFormat fontFormat) { var result = new CellFormat( this.OuterBorders?.DeepClone(), fontFormat, this.BackgroundColor?.DeepClone(), this.VerticalAlignment?.DeepClone(), this.HorizontalAlignment?.DeepClone(), this.FontRotationAngle?.DeepClone(), this.FillPattern?.DeepClone(), this.Options?.DeepClone()); return(result); }