Beispiel #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);
        }
Beispiel #2
0
 /// <summary>
 /// Creates the low level NoteRecord
 /// which holds the comment attributes.
 /// </summary>
 /// <param name="shape">The shape.</param>
 /// <param name="shapeId">The shape id.</param>
 /// <returns></returns>
 private NoteRecord CreateNoteRecord(HSSFComment shape, int shapeId)
 {
     NoteRecord note = new NoteRecord();
     note.Column = shape.Column;
     note.Row = shape.Row;
     note.Flags = (shape.Visible ? NoteRecord.NOTE_VISIBLE : NoteRecord.NOTE_HIDDEN);
     note.ShapeId = shapeId;
     note.Author = (shape.Author == null ? "" : shape.Author);
     return note;
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HSSFComment"/> class.
 /// </summary>
 /// <param name="note">The note.</param>
 /// <param name="txo">The txo.</param>
 public HSSFComment(NoteRecord note, TextObjectRecord txo):this((HSSFShape)null, (HSSFAnchor)null)
 {
     
     this.txo = txo;
     this.note = note;
 }
Beispiel #4
0
        /**
 * Get the {@link NoteRecord}s (related to cell comments) for this sheet
 * @return never <code>null</code>, typically empty array
 */
        public NoteRecord[] GetNoteRecords()
        {
            List<NoteRecord> temp = new List<NoteRecord>();
            for (int i = records.Count - 1; i >= 0; i--)
            {
                RecordBase rec = records[i];
                if (rec is NoteRecord)
                {
                    temp.Add((NoteRecord)rec);
                }
            }
            if (temp.Count < 1)
            {
                return NoteRecord.EMPTY_ARRAY;
            }
            NoteRecord[] result = new NoteRecord[temp.Count];
            result = temp.ToArray();
            return result;
        }
Beispiel #5
0
 public override Object Clone()
 {
     NoteRecord rec = new NoteRecord();
     rec.field_1_row = field_1_row;
     rec.field_2_col = field_2_col;
     rec.field_3_flags = field_3_flags;
     rec.field_4_shapeid = field_4_shapeid;
     rec.field_6_author = field_6_author;
     return rec;
 }