public ushort GetIndex(CellFont font) { string fontKey = font.ToString(); if (_indexLookup.ContainsKey(fontKey)) { return _indexLookup[fontKey]; } var f = new FONT { Height = font.Height, ColorIndex = font.Color.Index, Escapement = (ushort) font.Escapement, UnderlineStyle = (byte) font.UnderlineStyle, Family = (byte) font.Family, CharacterSet = 1, Name = font.Name, Bold = font.Bold, Italic = font.Italic, Strikethrough = font.Strikethrough, Outlined = font.Outlined, Shadowed = font.Shadowed, Condensed = font.Condensed, Extended = font.Extended }; _fonts.Add(f); _indexLookup.Add(fontKey, (ushort) (_fonts.Count - 1)); return (ushort) (_fonts.Count - 1); }
public CellFormat() { Font = new CellFont(); FormatString = new FormatString(); Border = new CellBorder(); Pattern = new CellPattern(); TextControl = new TextControl(); }