public void TestReserialize() { byte[] data = HexRead .ReadFromString("" + "94 08 00 00 00 00 00 00 00 00 00 00 04 00 07 00 00 6E 61 6D 65 00 63 6F 6D 6D 65 6E 74]"); RecordInputStream in1 = TestcaseRecordInputStream.Create(NameCommentRecord.sid, data); NameCommentRecord ncr = new NameCommentRecord(in1); Assert.AreEqual(0x0894, ncr.RecordType); Assert.AreEqual("name", ncr.NameText); Assert.AreEqual("comment", ncr.CommentText); byte[] data2 = ncr.Serialize(); TestcaseRecordInputStream.ConfirmRecordEncoding(NameCommentRecord.sid, data, data2); }
/** * If a {@link NameCommentRecord} is added or the name it references * is renamed, then this will update the lookup cache for it. */ public void UpdateNameCommentRecordCache(NameCommentRecord commentRecord) { if (commentRecords.ContainsValue(commentRecord)) { foreach (KeyValuePair<string, NameCommentRecord> entry in commentRecords) { if (entry.Value.Equals(commentRecord)) { commentRecords.Remove(entry.Key); break; } } } commentRecords[commentRecord.NameText] = commentRecord; }
/// <summary> /// Creates new HSSFName - called by HSSFWorkbook to Create a sheet from /// scratch. /// </summary> /// <param name="book">lowlevel Workbook object associated with the sheet.</param> /// <param name="name">the Name Record</param> /// <param name="comment"></param> internal HSSFName(HSSFWorkbook book, NameRecord name, NameCommentRecord comment) { this.book = book; this._definedNameRec = name; _commentRec = comment; }