示例#1
0
        /// <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 TestRead()
        {

            NoteStructureSubRecord record = new NoteStructureSubRecord(TestcaseRecordInputStream.Create(NoteStructureSubRecord.sid, data),data.Length);

            Assert.AreEqual(NoteStructureSubRecord.sid, record.Sid);
            Assert.AreEqual(data.Length , record.DataSize);

        }
示例#3
0
        public override Object Clone()
        {
            NoteStructureSubRecord rec = new NoteStructureSubRecord();

            byte[] recdata = new byte[reserved.Length];
            Array.Copy(reserved, 0, recdata, 0, recdata.Length);
            rec.reserved = recdata;
            return(rec);
        }
        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.Util.Arrays.Equals(src, cln));
        }
示例#6
0
文件: HSSFComment.cs 项目: WPG/npoi
        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 override Object Clone()
 {
     NoteStructureSubRecord rec = new NoteStructureSubRecord();
     byte[] recdata = new byte[reserved.Length];
     Array.Copy(reserved, 0, recdata, 0, recdata.Length);
     rec.reserved = recdata;
     return rec;
 }