/** * Sets the string contents of this cell * * @param s the new string contents */ public virtual void setString(string s) { if (s == null) { s = string.Empty; } contents = s; // Don't bother doing anything if this cell has not been referenced // yet - everything will be set up in due course if (!isReferenced()) { return; } Assert.verify(sharedStrings != null); // Initalize the shared string index index = sharedStrings.getIndex(contents); // Use the sharedStrings reference instead of this object's own // handle - this means that the bespoke copy becomes eligible for // garbage collection contents = sharedStrings.get(index); }
/** * Overrides the method in the base class in order to add the string * content to the shared string table, and to store its shared string * index * * @param fr the formatting records * @param ss the shared strings used within the workbook * @param s */ public override void setCellDetails(FormattingRecords fr, SharedStrings ss, WritableSheetImpl s) { base.setCellDetails(fr, ss, s); sharedStrings = ss; index = sharedStrings.getIndex(contents); // Use the sharedStrings reference instead of this object's own // handle - this means that the bespoke copy becomes eligible for // garbage collection contents = sharedStrings.get(index); }
/** * Overrides the method in the base class in order to add the string * content to the shared string table, and to store its shared string * index * * @param fr the formatting records * @param ss the shared strings used within the workbook * @param s */ public override void setCellDetails(FormattingRecords fr, SharedStrings ss, WritableSheetImpl s) { base.setCellDetails(fr, ss, s); sharedStrings = ss; index = sharedStrings.getIndex(contents); // Use the sharedStrings reference instead of this object's own // handle - this means that the bespoke copy becomes eligible for // garbage collection contents = sharedStrings.get(index); }