/// <summary> Adds a cell format to the hash map, keyed on its index. If the format /// record is not initialized, then its index number is determined and its /// initialize method called. If the font is not a built in format, then it /// is added to the list of formats for writing out /// /// </summary> /// <param name="fr">the format record /// </param> public void addFormat(DisplayFormat fr) { if (!fr.isInitialized()) { fr.initialize(nextCustomIndexNumber); nextCustomIndexNumber++; } if (nextCustomIndexNumber > maxFormatRecordsIndex) { nextCustomIndexNumber = maxFormatRecordsIndex; throw new NumFormatRecordsException(); } if (fr.FormatIndex >= nextCustomIndexNumber) { nextCustomIndexNumber = fr.FormatIndex + 1; } if (!fr.isBuiltIn()) { formatsList.Add(fr); formats[fr.FormatIndex] = fr; } }
/** * Adds a cell format to the hash map, keyed on its index. If the format * record is not initialized, then its index number is determined and its * initialize method called. If the font is not a built in format, then it * is added to the list of formats for writing out * * @param fr the format record */ public void addFormat(DisplayFormat fr) { // Handle the case the where the index number in the read Excel // file exhibits some major weirdness if (fr.isInitialized() && fr.getFormatIndex() >= maxFormatRecordsIndex) { //logger.warn("Format index exceeds Excel maximum - assigning custom number"); fr.initialize(nextCustomIndexNumber); nextCustomIndexNumber++; } // Initialize the format record with a custom index number if (!fr.isInitialized()) { fr.initialize(nextCustomIndexNumber); nextCustomIndexNumber++; } if (nextCustomIndexNumber > maxFormatRecordsIndex) { nextCustomIndexNumber = maxFormatRecordsIndex; throw new NumFormatRecordsException(); } if (fr.getFormatIndex() >= nextCustomIndexNumber) { nextCustomIndexNumber = fr.getFormatIndex() + 1; } if (!fr.isBuiltIn()) { formatsList.Add(fr); formats.Add(fr.getFormatIndex(), fr); } }