/// <summary> /// Sets the Top, Bottom, Left and Right shading for every cell in the row /// </summary> /// <param name="value"></param> /// <param name="fill">Hex fill color</param> /// <param name="color"></param> public void SetShading(ShadingPattern value, string fill, string color = "auto") { foreach (var cell in Cells) { cell.Shading.Set(value, fill, color); } }
private void setDefaultValues() { this.cvBack = 0; this.cvFore = 0; this.icoBack = Global.ColorIdentifier.auto; this.icoFore = Global.ColorIdentifier.auto; this.ipat = ShadingPattern.Automatic; }
/// <summary> /// Parses the bytes to retrieve a ShadingDescriptor. /// </summary> /// <param name="bytes">The bytes</param> public ShadingDescriptor(byte[] bytes) { if (bytes.Length == 10) { //it's a Word 2000/2003 descriptor this.cvFore = Utils.BitArrayToUInt32(new BitArray(new byte[] { bytes[2], bytes[1], bytes[0] })); this.cvBack = Utils.BitArrayToUInt32(new BitArray(new byte[] { bytes[6], bytes[5], bytes[4] })); this.ipat = (ShadingPattern)System.BitConverter.ToUInt16(bytes, 8); } else if (bytes.Length == 2) { //it's a Word 97 SPRM short val = System.BitConverter.ToInt16(bytes, 0); this.icoFore = (Global.ColorIdentifier)((val << 11) >> 11); this.icoBack = (Global.ColorIdentifier)((val << 2) >> 7); this.ipat = (ShadingPattern)(val >> 10); } else { throw new ByteParseException("Cannot parse the struct SHD, the length of the struct doesn't match"); } }
internal static DocumentFormat.OpenXml.Wordprocessing.ShadingPatternValues ToShadingPatternValues(ShadingPattern value) { return((DocumentFormat.OpenXml.Wordprocessing.ShadingPatternValues)((int)value)); }
/// <summary> /// Sets the pattern, fill and color /// </summary> /// <param name="value"></param> /// <param name="fill">Hex fill color</param> /// <param name="color"></param> public void Set(ShadingPattern value, string fill, string color = "auto") { Val = value; Color = color; Fill = fill; }