public static DocumentContext AddCellFormat(this DocumentContext documentContext, CellFormat cellFormat, string name) { Stylesheet stylesheet = documentContext.GetStylesheet(); if (stylesheet.CellFormats == null) { stylesheet.CellFormats = new CellFormats(); } cellFormat.SetAttachedName(name); stylesheet.CellFormats.AppendChild(cellFormat); stylesheet.CellFormats.Count = (uint)stylesheet.CellFormats.ChildElements.Count; return(documentContext); }