예제 #1
0
 /// <summary>
 /// Indexer for the comments collection
 /// </summary>
 /// <param name="cell">The cell</param>
 /// <returns>The comment</returns>
 public ExcelComment this[ExcelCellAddress cell]
 {
     get
     {
         ulong cellID = ExcelCellBase.GetCellID(Worksheet.SheetID, cell.Row, cell.Column);
         if (_comments.IndexOf(cellID) >= 0)
         {
             return(_comments[cellID] as ExcelComment);
         }
         else
         {
             return(null);
         }
     }
 }
예제 #2
0
        internal ExcelComment(XmlNamespaceManager ns, XmlNode commentTopNode, ExcelRangeBase cell)
            : base(null, cell, cell.Worksheet.VmlDrawingsComments.NameSpaceManager)
        {
            //_commentHelper = new XmlHelper(ns, commentTopNode);
            _commentHelper = XmlHelperFactory.Create(ns, commentTopNode);
            var textElem = commentTopNode.SelectSingleNode("d:text", ns);

            if (textElem == null)
            {
                textElem = commentTopNode.OwnerDocument.CreateElement("text", ExcelPackage.schemaMain);
                commentTopNode.AppendChild(textElem);
            }
            if (!cell.Worksheet._vmlDrawings.ContainsKey(ExcelAddress.GetCellID(cell.Worksheet.SheetID, cell.Start.Row, cell.Start.Column)))
            {
                cell.Worksheet._vmlDrawings.Add(cell);
            }

            TopNode  = cell.Worksheet.VmlDrawingsComments[ExcelCellBase.GetCellID(cell.Worksheet.SheetID, cell.Start.Row, cell.Start.Column)].TopNode;
            RichText = new ExcelRichTextCollection(ns, textElem);
        }