HSSFComment

Namespace: NPOI
We found 10 examples in language CSharp for this search. You will see 25 fragments of code.
/* ====================================================================
   Licensed to the Apache Software Foundation (ASF) Under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for Additional information regarding copyright ownership.
   The ASF licenses this file to You Under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed Under the License is distributed on an "AS Is" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations Under the License.
==================================================================== */
namespace Chama.Utils.NPOI.HSSF.UserModel
{
    using System;
    using System.Collections;

    using Chama.Utils.NPOI.Util;
    using Chama.Utils.NPOI.DDF;
    using Chama.Utils.NPOI.HSSF.Record;
    using Chama.Utils.NPOI.SS.UserModel;


    /// <summary>
    /// Represents a cell comment - a sticky note associated with a cell.
    /// @author Yegor Kozlov
    /// </summary>
    [Serializable]
    public class HSSFComment : HSSFTextbox,IComment
    {

        private bool visible;
        private int col, row;
        private String author;

        [NonSerialized]
        private NoteRecord note = null;
        [NonSerialized]
        private TextObjectRecord txo = null;

        /// <summary>
        /// Construct a new comment with the given parent and anchor.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="anchor">defines position of this anchor in the sheet</param>
        public HSSFComment(HSSFShape parent, HSSFAnchor anchor):base(parent, anchor)
        {
            
            this.ShapeType = (OBJECT_TYPE_COMMENT);

            //default color for comments
            this.FillColor = 0x08000050;

            //by default comments are hidden
            visible = false;

            author = "";
        }
        /// <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;
        }

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="HSSFComment"/> is visible.
        /// </summary>
        /// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
        /// Sets whether this comment Is visible.
        /// @return 
        /// <c>true</c>
        ///  if the comment Is visible, 
        /// <c>false</c>
        ///  otherwise
        public bool Visible
        {
            get
            {
                return this.visible;
            }
            set {
                if (note != null) note.Flags = value ? NoteRecord.NOTE_VISIBLE : NoteRecord.NOTE_HIDDEN;
                this.visible = value;
            }
        }

        /// <summary>
        /// Gets or sets the row of the cell that Contains the comment
        /// </summary>
        /// <value>the 0-based row of the cell that Contains the comment</value>
        public int Row
        {
            get{return row;}
            set{            
                if (note != null) note.Row=value;
            this.row = value;}
        }


        /// <summary>
        /// Gets or sets the column of the cell that Contains the comment
        /// </summary>
        /// <value>the 0-based column of the cell that Contains the comment</value>
        public int Column
        {
            get { return col; }
            set
            {
                if (note != null) note.Column=value;
                this.col = value;
            }
        }

        /// <summary>
        /// Gets or sets the name of the original comment author
        /// </summary>
        /// <value>the name of the original author of the comment</value>
        public String Author
        {
            get
            {
                return author;
            }
            set
            {
                if (note != null) note.Author = value;
                this.author = value;
            }
        }

        /// <summary>
        /// Gets or sets the rich text string used by this comment.
        /// </summary>   
        public override IRichTextString String
        {
            get { return base.String; }
            set
            {
                //if font Is not Set we must Set the default one
                if (value.NumFormattingRuns == 0) value.ApplyFont((short)0);

                if (txo != null)
                {
                    txo.Str=value;
                }
                base.String = value;
            }
        }

        /// <summary>
        /// Gets the note record.
        /// </summary>
        /// <value>the underlying Note record.</value>
        public NoteRecord NoteRecord
        {
            get { return note; }
        }
        /// <summary>
        /// Gets the text object record.
        /// </summary>
        /// <value>the underlying Text record</value>
        public TextObjectRecord TextObjectRecord
        {
            get { return txo; }
        }

    }
}


        /// <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;
        }

        /// <summary>
        /// Sets standard escher options for a comment.
        /// This method is responsible for Setting default background,
        /// shading and other comment properties.
        /// </summary>
        /// <param name="shape">The highlevel shape.</param>
        /// <param name="opt">The escher records holding the proerties</param>
        /// <returns>The number of escher options added</returns>
        protected override int AddStandardOptions(HSSFShape shape, EscherOptRecord opt)
        {
            base.AddStandardOptions(shape, opt);

            //Remove Unnecessary properties inherited from TextboxShape
            for (int i = 0; i < opt.EscherProperties.Count; i++ )
            {
                EscherProperty prop = opt.EscherProperties[i];
                switch (prop.Id)
                {
                    case EscherProperties.TEXT__TEXTLEFT:
                    case EscherProperties.TEXT__TEXTRIGHT:
                    case EscherProperties.TEXT__TEXTTOP:
                    case EscherProperties.TEXT__TEXTBOTTOM:
                    case EscherProperties.GROUPSHAPE__PRINT:
                    case EscherProperties.Fill__FillBACKCOLOR:
                    case EscherProperties.LINESTYLE__COLOR:
                        opt.EscherProperties.Remove(prop);
                        i--;
                        break;
                }
            }

            HSSFComment comment = (HSSFComment)shape;
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, comment.Visible ? 0x000A0000 : 0x000A0002));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__SHADOWOBSURED, 0x00030003));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__COLOR, 0x00000000));
            opt.SortProperties();
            return opt.EscherProperties.Count;   // # options Added
        }
        protected override int GetCmoObjectId(int shapeId)
        {
            return shapeId;
        }

/* ====================================================================
   Licensed to the Apache Software Foundation (ASF) Under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for Additional information regarding copyright ownership.
   The ASF licenses this file to You Under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed Under the License is distributed on an "AS Is" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations Under the License.
==================================================================== */
namespace Zephyr.Utils.NPOI.HSSF.UserModel
{
    using System;
    using System.Collections;

    using Zephyr.Utils.NPOI.Util;
    using Zephyr.Utils.NPOI.DDF;
    using Zephyr.Utils.NPOI.HSSF.Record;
    using Zephyr.Utils.NPOI.SS.UserModel;


    /// <summary>
    /// Represents a cell comment - a sticky note associated with a cell.
    /// @author Yegor Kozlov
    /// </summary>
    [Serializable]
    public class HSSFComment : HSSFTextbox,IComment
    {

        private bool visible;
        private int col, row;
        private String author;

        [NonSerialized]
        private NoteRecord note = null;
        [NonSerialized]
        private TextObjectRecord txo = null;

        /// <summary>
        /// Construct a new comment with the given parent and anchor.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="anchor">defines position of this anchor in the sheet</param>
        public HSSFComment(HSSFShape parent, HSSFAnchor anchor):base(parent, anchor)
        {
            
            this.ShapeType = (OBJECT_TYPE_COMMENT);

            //default color for comments
            this.FillColor = 0x08000050;

            //by default comments are hidden
            visible = false;

            author = "";
        }
        /// <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;
        }

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="HSSFComment"/> is visible.
        /// </summary>
        /// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
        /// Sets whether this comment Is visible.
        /// @return 
        /// <c>true</c>
        ///  if the comment Is visible, 
        /// <c>false</c>
        ///  otherwise
        public bool Visible
        {
            get
            {
                return this.visible;
            }
            set {
                if (note != null) note.Flags = value ? NoteRecord.NOTE_VISIBLE : NoteRecord.NOTE_HIDDEN;
                this.visible = value;
            }
        }

        /// <summary>
        /// Gets or sets the row of the cell that Contains the comment
        /// </summary>
        /// <value>the 0-based row of the cell that Contains the comment</value>
        public int Row
        {
            get{return row;}
            set{            
                if (note != null) note.Row=value;
            this.row = value;}
        }


        /// <summary>
        /// Gets or sets the column of the cell that Contains the comment
        /// </summary>
        /// <value>the 0-based column of the cell that Contains the comment</value>
        public int Column
        {
            get { return col; }
            set
            {
                if (note != null) note.Column=value;
                this.col = value;
            }
        }

        /// <summary>
        /// Gets or sets the name of the original comment author
        /// </summary>
        /// <value>the name of the original author of the comment</value>
        public String Author
        {
            get
            {
                return author;
            }
            set
            {
                if (note != null) note.Author = value;
                this.author = value;
            }
        }

        /// <summary>
        /// Gets or sets the rich text string used by this comment.
        /// </summary>   
        public override IRichTextString String
        {
            get { return base.String; }
            set
            {
                //if font Is not Set we must Set the default one
                if (value.NumFormattingRuns == 0) value.ApplyFont((short)0);

                if (txo != null)
                {
                    txo.Str=value;
                }
                base.String = value;
            }
        }

        /// <summary>
        /// Gets the note record.
        /// </summary>
        /// <value>the underlying Note record.</value>
        public NoteRecord NoteRecord
        {
            get { return note; }
        }
        /// <summary>
        /// Gets the text object record.
        /// </summary>
        /// <value>the underlying Text record</value>
        public TextObjectRecord TextObjectRecord
        {
            get { return txo; }
        }

    }
}

/* ====================================================================
   Licensed to the Apache Software Foundation (ASF) Under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for Additional information regarding copyright ownership.
   The ASF licenses this file to You Under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed Under the License is distributed on an "AS Is" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations Under the License.
==================================================================== */
namespace Zephyr.Utils.NPOI.HSSF.UserModel
{
    using System;
    using System.Collections;

    using Zephyr.Utils.NPOI.Util;
    using Zephyr.Utils.NPOI.DDF;
    using Zephyr.Utils.NPOI.HSSF.Record;
    using Zephyr.Utils.NPOI.SS.UserModel;


    /// <summary>
    /// Represents a cell comment - a sticky note associated with a cell.
    /// @author Yegor Kozlov
    /// </summary>
    [Serializable]
    public class HSSFComment : HSSFTextbox,IComment
    {

        private bool visible;
        private int col, row;
        private String author;

        [NonSerialized]
        private NoteRecord note = null;
        [NonSerialized]
        private TextObjectRecord txo = null;

        /// <summary>
        /// Construct a new comment with the given parent and anchor.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="anchor">defines position of this anchor in the sheet</param>
        public HSSFComment(HSSFShape parent, HSSFAnchor anchor):base(parent, anchor)
        {
            
            this.ShapeType = (OBJECT_TYPE_COMMENT);

            //default color for comments
            this.FillColor = 0x08000050;

            //by default comments are hidden
            visible = false;

            author = "";
        }
        /// <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;
        }

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="HSSFComment"/> is visible.
        /// </summary>
        /// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
        /// Sets whether this comment Is visible.
        /// @return 
        /// <c>true</c>
        ///  if the comment Is visible, 
        /// <c>false</c>
        ///  otherwise
        public bool Visible
        {
            get
            {
                return this.visible;
            }
            set {
                if (note != null) note.Flags = value ? NoteRecord.NOTE_VISIBLE : NoteRecord.NOTE_HIDDEN;
                this.visible = value;
            }
        }

        /// <summary>
        /// Gets or sets the row of the cell that Contains the comment
        /// </summary>
        /// <value>the 0-based row of the cell that Contains the comment</value>
        public int Row
        {
            get{return row;}
            set{            
                if (note != null) note.Row=value;
            this.row = value;}
        }


        /// <summary>
        /// Gets or sets the column of the cell that Contains the comment
        /// </summary>
        /// <value>the 0-based column of the cell that Contains the comment</value>
        public int Column
        {
            get { return col; }
            set
            {
                if (note != null) note.Column=value;
                this.col = value;
            }
        }

        /// <summary>
        /// Gets or sets the name of the original comment author
        /// </summary>
        /// <value>the name of the original author of the comment</value>
        public String Author
        {
            get
            {
                return author;
            }
            set
            {
                if (note != null) note.Author = value;
                this.author = value;
            }
        }

        /// <summary>
        /// Gets or sets the rich text string used by this comment.
        /// </summary>   
        public override IRichTextString String
        {
            get { return base.String; }
            set
            {
                //if font Is not Set we must Set the default one
                if (value.NumFormattingRuns == 0) value.ApplyFont((short)0);

                if (txo != null)
                {
                    txo.Str=value;
                }
                base.String = value;
            }
        }

        /// <summary>
        /// Gets the note record.
        /// </summary>
        /// <value>the underlying Note record.</value>
        public NoteRecord NoteRecord
        {
            get { return note; }
        }
        /// <summary>
        /// Gets the text object record.
        /// </summary>
        /// <value>the underlying Text record</value>
        public TextObjectRecord TextObjectRecord
        {
            get { return txo; }
        }

    }
}


        /// <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;
        }

        /// <summary>
        /// Sets standard escher options for a comment.
        /// This method is responsible for Setting default background,
        /// shading and other comment properties.
        /// </summary>
        /// <param name="shape">The highlevel shape.</param>
        /// <param name="opt">The escher records holding the proerties</param>
        /// <returns>The number of escher options added</returns>
        protected override int AddStandardOptions(HSSFShape shape, EscherOptRecord opt)
        {
            base.AddStandardOptions(shape, opt);

            //Remove Unnecessary properties inherited from TextboxShape
            for (int i = 0; i < opt.EscherProperties.Count; i++ )
            {
                EscherProperty prop = opt.EscherProperties[i];
                switch (prop.Id)
                {
                    case EscherProperties.TEXT__TEXTLEFT:
                    case EscherProperties.TEXT__TEXTRIGHT:
                    case EscherProperties.TEXT__TEXTTOP:
                    case EscherProperties.TEXT__TEXTBOTTOM:
                    case EscherProperties.GROUPSHAPE__PRINT:
                    case EscherProperties.Fill__FillBACKCOLOR:
                    case EscherProperties.LINESTYLE__COLOR:
                        opt.EscherProperties.Remove(prop);
                        i--;
                        break;
                }
            }

            HSSFComment comment = (HSSFComment)shape;
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, comment.Visible ? 0x000A0000 : 0x000A0002));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__SHADOWOBSURED, 0x00030003));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__COLOR, 0x00000000));
            opt.SortProperties();
            return opt.EscherProperties.Count;   // # options Added
        }
        protected override int GetCmoObjectId(int shapeId)
        {
            return shapeId;
        }



        internal override void AfterInsert(HSSFPatriarch patriarch)
        {
            base.AfterInsert(patriarch);
            patriarch.getBoundAggregate().AddTailRecord(NoteRecord);
        }

        protected override EscherContainerRecord CreateSpContainer()
        {
            EscherContainerRecord spContainer = base.CreateSpContainer();
            EscherOptRecord opt = (EscherOptRecord)spContainer.GetChildById(EscherOptRecord.RECORD_ID);
            opt.RemoveEscherProperty(EscherProperties.TEXT__TEXTLEFT);
            opt.RemoveEscherProperty(EscherProperties.TEXT__TEXTRIGHT);
            opt.RemoveEscherProperty(EscherProperties.TEXT__TEXTTOP);
            opt.RemoveEscherProperty(EscherProperties.TEXT__TEXTBOTTOM);
            opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, false, false, 655362));
            return spContainer;
        }


        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;
        }

        private NoteRecord CreateNoteRecord()
        {
            NoteRecord note = new NoteRecord();
            note.Flags = (NoteRecord.NOTE_HIDDEN);
            note.Author = ("");
            return note;
        }
        

        internal override void AfterRemove(HSSFPatriarch patriarch)
        {
            base.AfterRemove(patriarch);
            patriarch.getBoundAggregate().RemoveTailRecord(this.NoteRecord);
        }
        internal override HSSFShape CloneShape()
        {
            TextObjectRecord txo = (TextObjectRecord)GetTextObjectRecord().CloneViaReserialise();
            EscherContainerRecord spContainer = new EscherContainerRecord();
            byte[] inSp = GetEscherContainer().Serialize();
            spContainer.FillFields(inSp, 0, new DefaultEscherRecordFactory());
            ObjRecord obj = (ObjRecord)GetObjRecord().CloneViaReserialise();
            NoteRecord note = (NoteRecord)NoteRecord.CloneViaReserialise();
            return new HSSFComment(spContainer, obj, txo, note);
        }

/* ====================================================================
   Licensed to the Apache Software Foundation (ASF) Under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for Additional information regarding copyright ownership.
   The ASF licenses this file to You Under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed Under the License is distributed on an "AS Is" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations Under the License.
==================================================================== */
namespace LONG.Utils.NPOI.HSSF.UserModel
{
    using System;
    using System.Collections;

    using LONG.Utils.NPOI.Util;
    using LONG.Utils.NPOI.DDF;
    using LONG.Utils.NPOI.HSSF.Record;
    using LONG.Utils.NPOI.SS.UserModel;


    /// <summary>
    /// Represents a cell comment - a sticky note associated with a cell.
    /// @author Yegor Kozlov
    /// </summary>
    [Serializable]
    public class HSSFComment : HSSFTextbox,IComment
    {

        private bool visible;
        private int col, row;
        private String author;

        [NonSerialized]
        private NoteRecord note = null;
        [NonSerialized]
        private TextObjectRecord txo = null;

        /// <summary>
        /// Construct a new comment with the given parent and anchor.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="anchor">defines position of this anchor in the sheet</param>
        public HSSFComment(HSSFShape parent, HSSFAnchor anchor):base(parent, anchor)
        {
            
            this.ShapeType = (OBJECT_TYPE_COMMENT);

            //default color for comments
            this.FillColor = 0x08000050;

            //by default comments are hidden
            visible = false;

            author = "";
        }
        /// <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;
        }

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="HSSFComment"/> is visible.
        /// </summary>
        /// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
        /// Sets whether this comment Is visible.
        /// @return 
        /// <c>true</c>
        ///  if the comment Is visible, 
        /// <c>false</c>
        ///  otherwise
        public bool Visible
        {
            get
            {
                return this.visible;
            }
            set {
                if (note != null) note.Flags = value ? NoteRecord.NOTE_VISIBLE : NoteRecord.NOTE_HIDDEN;
                this.visible = value;
            }
        }

        /// <summary>
        /// Gets or sets the row of the cell that Contains the comment
        /// </summary>
        /// <value>the 0-based row of the cell that Contains the comment</value>
        public int Row
        {
            get{return row;}
            set{            
                if (note != null) note.Row=value;
            this.row = value;}
        }


        /// <summary>
        /// Gets or sets the column of the cell that Contains the comment
        /// </summary>
        /// <value>the 0-based column of the cell that Contains the comment</value>
        public int Column
        {
            get { return col; }
            set
            {
                if (note != null) note.Column=value;
                this.col = value;
            }
        }

        /// <summary>
        /// Gets or sets the name of the original comment author
        /// </summary>
        /// <value>the name of the original author of the comment</value>
        public String Author
        {
            get
            {
                return author;
            }
            set
            {
                if (note != null) note.Author = value;
                this.author = value;
            }
        }

        /// <summary>
        /// Gets or sets the rich text string used by this comment.
        /// </summary>   
        public override IRichTextString String
        {
            get { return base.String; }
            set
            {
                //if font Is not Set we must Set the default one
                if (value.NumFormattingRuns == 0) value.ApplyFont((short)0);

                if (txo != null)
                {
                    txo.Str=value;
                }
                base.String = value;
            }
        }

        /// <summary>
        /// Gets the note record.
        /// </summary>
        /// <value>the underlying Note record.</value>
        public NoteRecord NoteRecord
        {
            get { return note; }
        }
        /// <summary>
        /// Gets the text object record.
        /// </summary>
        /// <value>the underlying Text record</value>
        public TextObjectRecord TextObjectRecord
        {
            get { return txo; }
        }

    }
}


        /// <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;
        }

        /// <summary>
        /// Sets standard escher options for a comment.
        /// This method is responsible for Setting default background,
        /// shading and other comment properties.
        /// </summary>
        /// <param name="shape">The highlevel shape.</param>
        /// <param name="opt">The escher records holding the proerties</param>
        /// <returns>The number of escher options added</returns>
        protected override int AddStandardOptions(HSSFShape shape, EscherOptRecord opt)
        {
            base.AddStandardOptions(shape, opt);

            //Remove Unnecessary properties inherited from TextboxShape
            for (int i = 0; i < opt.EscherProperties.Count; i++ )
            {
                EscherProperty prop = opt.EscherProperties[i];
                switch (prop.Id)
                {
                    case EscherProperties.TEXT__TEXTLEFT:
                    case EscherProperties.TEXT__TEXTRIGHT:
                    case EscherProperties.TEXT__TEXTTOP:
                    case EscherProperties.TEXT__TEXTBOTTOM:
                    case EscherProperties.GROUPSHAPE__PRINT:
                    case EscherProperties.FILL__FILLBACKCOLOR:
                    case EscherProperties.LINESTYLE__COLOR:
                        opt.EscherProperties.Remove(prop);
                        i--;
                        break;
                }
            }

            HSSFComment comment = (HSSFComment)shape;
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, comment.Visible ? 0x000A0000 : 0x000A0002));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__SHADOWOBSURED, 0x00030003));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__COLOR, 0x00000000));
            opt.SortProperties();
            return opt.EscherProperties.Count;   // # options Added
        }
        protected override int GetCmoObjectId(int shapeId)
        {
            return shapeId;
        }


        /// <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;
        }

        /// <summary>
        /// Sets standard escher options for a comment.
        /// This method is responsible for Setting default background,
        /// shading and other comment properties.
        /// </summary>
        /// <param name="shape">The highlevel shape.</param>
        /// <param name="opt">The escher records holding the proerties</param>
        /// <returns>The number of escher options added</returns>
        protected override int AddStandardOptions(HSSFShape shape, EscherOptRecord opt)
        {
            base.AddStandardOptions(shape, opt);

            //Remove Unnecessary properties inherited from TextboxShape
            for (int i = 0; i < opt.EscherProperties.Count; i++ )
            {
                EscherProperty prop = opt.EscherProperties[i];
                switch (prop.Id)
                {
                    case EscherProperties.TEXT__TEXTLEFT:
                    case EscherProperties.TEXT__TEXTRIGHT:
                    case EscherProperties.TEXT__TEXTTOP:
                    case EscherProperties.TEXT__TEXTBOTTOM:
                    case EscherProperties.GROUPSHAPE__PRINT:
                    case EscherProperties.FILL__FILLBACKCOLOR:
                    case EscherProperties.LINESTYLE__COLOR:
                        opt.EscherProperties.Remove(prop);
                        i--;
                        break;
                }
            }

            HSSFComment comment = (HSSFComment)shape;
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, comment.Visible ? 0x000A0000 : 0x000A0002));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__SHADOWOBSURED, 0x00030003));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__COLOR, 0x00000000));
            opt.SortProperties();
            return opt.EscherProperties.Count;   // # options Added
        }
        protected override int GetCmoObjectId(int shapeId)
        {
            return shapeId;
        }


        /// <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;
        }

        /// <summary>
        /// Sets standard escher options for a comment.
        /// This method is responsible for Setting default background,
        /// shading and other comment properties.
        /// </summary>
        /// <param name="shape">The highlevel shape.</param>
        /// <param name="opt">The escher records holding the proerties</param>
        /// <returns>The number of escher options added</returns>
        protected override int AddStandardOptions(HSSFShape shape, EscherOptRecord opt)
        {
            base.AddStandardOptions(shape, opt);

            //Remove Unnecessary properties inherited from TextboxShape
            for (int i = 0; i < opt.EscherProperties.Count; i++ )
            {
                EscherProperty prop = opt.EscherProperties[i];
                switch (prop.Id)
                {
                    case EscherProperties.TEXT__TEXTLEFT:
                    case EscherProperties.TEXT__TEXTRIGHT:
                    case EscherProperties.TEXT__TEXTTOP:
                    case EscherProperties.TEXT__TEXTBOTTOM:
                    case EscherProperties.GROUPSHAPE__PRINT:
                    case EscherProperties.Fill__FillBACKCOLOR:
                    case EscherProperties.LINESTYLE__COLOR:
                        opt.EscherProperties.Remove(prop);
                        i--;
                        break;
                }
            }

            HSSFComment comment = (HSSFComment)shape;
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, comment.Visible ? 0x000A0000 : 0x000A0002));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__SHADOWOBSURED, 0x00030003));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__COLOR, 0x00000000));
            opt.SortProperties();
            return opt.EscherProperties.Count;   // # options Added
        }
        protected override int GetCmoObjectId(int shapeId)
        {
            return shapeId;
        }

NPOI.HSSF.UserModel.HSSFComment : IComment

Constructors :

public HSSFComment(EscherContainerRecord spContainer = , ObjRecord objRecord = , TextObjectRecord textObjectRecord = , NoteRecord _note = )
public HSSFComment(HSSFShape parent = , HSSFAnchor anchor = )
public HSSFComment(NoteRecord note = , TextObjectRecord txo = )

Methods :

public Int32 get_ShapeId()
public Void set_ShapeId(Int32 value = )
public Boolean get_Visible()
public Void set_Visible(Boolean value = )
public CellAddress get_Address()
public Void set_Address(CellAddress value = )
public Void SetAddress(Int32 row = , Int32 col = )
public Int32 get_Row()
public Void set_Row(Int32 value = )
public Int32 get_Column()
public Void set_Column(Int32 value = )
public String get_Author()
public Void set_Author(String value = )
public Boolean get_HasPosition()
public IClientAnchor get_ClientAnchor()
public Int32 get_ShapeType()
public Void set_ShapeType(Int32 value = )
public Void SetBackgroundImage(Int32 pictureIndex = )
public Void ResetBackgroundImage()
public Int32 GetBackgroundImageId()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()
public Int32 get_MarginLeft()
public Void set_MarginLeft(Int32 value = )
public Int32 get_MarginRight()
public Void set_MarginRight(Int32 value = )
public Int32 get_MarginTop()
public Void set_MarginTop(Int32 value = )
public Int32 get_MarginBottom()
public Void set_MarginBottom(Int32 value = )
public HorizontalTextAlignment get_HorizontalAlignment()
public Void set_HorizontalAlignment(HorizontalTextAlignment value = )
public VerticalTextAlignment get_VerticalAlignment()
public Void set_VerticalAlignment(VerticalTextAlignment value = )
public Int32 get_WrapText()
public Void set_WrapText(Int32 value = )
public IRichTextString get_String()
public Void set_String(IRichTextString value = )
public Boolean get_FlipVertical()
public Void set_FlipVertical(Boolean value = )
public Boolean get_FlipHorizontal()
public Void set_FlipHorizontal(Boolean value = )
public HSSFShape get_Parent()
public Void set_Parent(HSSFShape value = )
public HSSFAnchor get_Anchor()
public Void set_Anchor(HSSFAnchor value = )
public Int32 get_LineStyleColor()
public Void set_LineStyleColor(Int32 value = )
public Void SetLineStyleColor(Int32 red = , Int32 green = , Int32 blue = )
public Int32 get_FillColor()
public Void set_FillColor(Int32 value = )
public Void SetFillColor(Int32 red = , Int32 green = , Int32 blue = )
public Int32 get_LineWidth()
public Void set_LineWidth(Int32 value = )
public LineStyle get_LineStyle()
public Void set_LineStyle(LineStyle value = )
public Boolean get_IsNoFill()
public Void set_IsNoFill(Boolean value = )
public Boolean get_IsFlipVertical()
public Void set_IsFlipVertical(Boolean value = )
public Boolean get_IsFlipHorizontal()
public Void set_IsFlipHorizontal(Boolean value = )
public Int32 get_RotationDegree()
public Void set_RotationDegree(Int32 value = )
public Int32 get_CountOfAllChildren()
public HSSFPatriarch get_Patriarch()
public Void set_Patriarch(HSSFPatriarch value = )
public Type GetType()
public String ToString()