public void TestRead() { NoteStructureSubRecord record = new NoteStructureSubRecord(TestcaseRecordInputStream.Create(NoteStructureSubRecord.sid, data), data.Length); Assert.AreEqual(NoteStructureSubRecord.sid, record.Sid); Assert.AreEqual(data.Length, record.DataSize); }
/// <summary> /// Creates the low-level records for a comment. /// </summary> /// <param name="hssfShape">The highlevel shape.</param> /// <param name="shapeId">The shape id to use for this shape.</param> public CommentShape(HSSFComment hssfShape, int shapeId) : base(hssfShape, shapeId) { note = CreateNoteRecord(hssfShape, shapeId); ObjRecord obj = ObjRecord; List <SubRecord> records = obj.SubRecords; int cmoIdx = 0; for (int i = 0; i < records.Count; i++) { Object r = records[i]; if (r is CommonObjectDataSubRecord) { //modify autoFill attribute inherited from <c>TextObjectRecord</c> CommonObjectDataSubRecord cmo = (CommonObjectDataSubRecord)r; cmo.IsAutoFill = (false); cmoIdx = i; } } //Add NoteStructure sub record //we don't know it's format, for now the record data Is empty NoteStructureSubRecord u = new NoteStructureSubRecord(); obj.AddSubRecord(cmoIdx + 1, u); }
public void TestWrite() { NoteStructureSubRecord record = new NoteStructureSubRecord(); Assert.AreEqual(NoteStructureSubRecord.sid, record.Sid); Assert.AreEqual(data.Length, record.DataSize); byte[] ser = record.Serialize(); Assert.AreEqual(ser.Length - 4, data.Length); }
public void TestClone() { NoteStructureSubRecord record = new NoteStructureSubRecord(); byte[] src = record.Serialize(); NoteStructureSubRecord cloned = (NoteStructureSubRecord)record.Clone(); byte[] cln = cloned.Serialize(); Assert.AreEqual(record.DataSize, cloned.DataSize); Assert.IsTrue(Npoi.Core.Util.Arrays.Equals(src, cln)); }
protected override ObjRecord CreateObjRecord() { ObjRecord obj = new ObjRecord(); CommonObjectDataSubRecord c = new CommonObjectDataSubRecord(); c.ObjectType = (CommonObjectType)OBJECT_TYPE_COMMENT; c.IsLocked = (true); c.IsPrintable = (true); c.IsAutoFill = (false); c.IsAutoline = (true); NoteStructureSubRecord u = new NoteStructureSubRecord(); EndSubRecord e = new EndSubRecord(); obj.AddSubRecord(c); obj.AddSubRecord(u); obj.AddSubRecord(e); return(obj); }
public static Record CreateSubRecord(RecordInputStream in1) { Record r = null; /* This must surely be an earlier hack?? Delete when confident short adjustedSize = size; if ( size < 0 ) { adjustedSize = 0; } else if ( offset + size > data.Length ) { adjustedSize = (short) ( data.Length - offset ); if ( adjustedSize > 4 ) { adjustedSize -= 4; } } */ switch (in1.Sid) { case CommonObjectDataSubRecord.sid: r = new CommonObjectDataSubRecord(in1); break; case EmbeddedObjectRefSubRecord.sid: r = new EmbeddedObjectRefSubRecord(in1); break; case GroupMarkerSubRecord.sid: r = new GroupMarkerSubRecord(in1); break; case EndSubRecord.sid: r = new EndSubRecord(in1); break; case NoteStructureSubRecord.sid: r = new NoteStructureSubRecord(in1); break; default: r = new UnknownRecord(in1); break; } return r; }