/// <summary> If this cell has not been read in from an existing Excel sheet, /// then initializes this record with the XF index passed in. Calls /// initialized on the font and format record /// /// </summary> /// <param name="pos">the xf index to initialize this record with /// </param> /// <param name="fr">the containing formatting records /// </param> /// <param name="fonts">the container for the fonts /// </param> /// <exception cref=""> NumFormatRecordsException /// </exception> public void initialize(int pos, FormattingRecords fr, Fonts fonts) { xfIndex = pos; formattingRecords = fr; // If this file has been read in or copied, // the font and format indexes will // already be initialized, so just set the initialized flag and // return if (read || copied) { initialized = true; return; } if (!font.IsInitialized()) { fonts.addFont(font); } if (!format.isInitialized()) { fr.addFormat(format); } fontIndex = font.FontIndex; formatIndex = format.FormatIndex; initialized = true; }
/// <summary> Adds a font record to this workbook. If the FontRecord passed in has not /// been initialized, then its font index is determined based upon the size /// of the fonts list. The FontRecord's initialized method is called, and /// it is added to the list of fonts. /// /// </summary> /// <param name="f">the font to add /// </param> public virtual void addFont(FontRecord f) { if (!f.IsInitialized()) { int pos = fonts.Count; // Remember that the pos with index 4 is skipped if (pos >= 4) { pos++; } f.initialize(pos); fonts.Add(f); } }