Example #1
0
        /// <summary>
        ///     Insert comment given the cell reference of the cell it's based on. This will overwrite any existing comment.
        /// </summary>
        /// <param name="CellReference">The cell reference, such as "A1".</param>
        /// <param name="Comment">The cell comment.</param>
        /// <returns>False if the cell reference is invalid. True otherwise.</returns>
        public bool InsertComment(string CellReference, SLComment Comment)
        {
            var iRowIndex    = -1;
            var iColumnIndex = -1;

            if (!SLTool.FormatCellReferenceToRowColumnIndex(CellReference, out iRowIndex, out iColumnIndex))
            {
                return(false);
            }

            return(InsertComment(iRowIndex, iColumnIndex, Comment));
        }
Example #2
0
        /// <summary>
        ///     Insert comment given the row index and column index of the cell it's based on. This will overwrite any existing
        ///     comment.
        /// </summary>
        /// <param name="RowIndex">The row index.</param>
        /// <param name="ColumnIndex">The column index.</param>
        /// <param name="Comment">The cell comment.</param>
        /// <returns>False if either the row index or column index (or both) are invalid. True otherwise.</returns>
        public bool InsertComment(int RowIndex, int ColumnIndex, SLComment Comment)
        {
            if (!SLTool.CheckRowColumnIndexLimit(RowIndex, ColumnIndex))
            {
                return(false);
            }

            if (!slws.Authors.Contains(Comment.Author))
            {
                slws.Authors.Add(Comment.Author);
            }

            var pt   = new SLCellPoint(RowIndex, ColumnIndex);
            var comm = Comment.Clone();

            slws.Comments[pt] = comm;

            return(true);
        }