public ITablePartStyle SetFont(OpenXmlFontRef fontRef) { TableCellTextStyle tableCellTextStyle = this.tableCellTextStyleGenerator(true); tableCellTextStyle.RemoveAllChildren <FontReference>(); tableCellTextStyle.RemoveAllChildren <Fonts>(); FontReference element = new FontReference { Index = (FontCollectionIndexValues)fontRef.Index }; if (fontRef.Color != null) { element.AppendChild(fontRef.Color.CreateColorElement()); } tableCellTextStyle.PrependChild(element); return(this.result); }
public ITablePartStyle SetFont(string typeface) { TableCellTextStyle tableCellTextStyle = this.tableCellTextStyleGenerator(true); tableCellTextStyle.RemoveAllChildren <FontReference>(); tableCellTextStyle.RemoveAllChildren <Fonts>(); tableCellTextStyle.PrependChild( new Fonts( new LatinFont() { Typeface = typeface }, new ComplexScriptFont() { Typeface = typeface } ) ); return(this.result); }