Drawing object used for comments
Inheritance: OfficeOpenXml.Drawing.Vml.ExcelVmlDrawingBase, IRangeID
Beispiel #1
0
        internal ExcelVmlDrawingComment Add(ExcelRangeBase cell)
        {
            XmlNode node = AddDrawing(cell);
            var     draw = new ExcelVmlDrawingComment(node, cell, NameSpaceManager);

            _drawings.Add(draw);
            return(draw);
        }
Beispiel #2
0
        internal ExcelVmlDrawingComment AddComment(ExcelRangeBase cell)
        {
            XmlNode node = AddCommentDrawing(cell);
            var     draw = new ExcelVmlDrawingComment(node, cell, NameSpaceManager);

            _drawings.Add(draw);
            _drawingsCellStore.SetValue(cell._fromRow, cell._fromCol, _drawings.Count - 1);
            return(draw);
        }
Beispiel #3
0
        protected internal void AddDrawingsFromXml(ExcelWorksheet ws)
        {
            var nodes = VmlDrawingXml.SelectNodes("//v:shape", NameSpaceManager);

            //var list = new List<IRangeID>();
            foreach (XmlNode node in nodes)
            {
                var objectType = node.SelectSingleNode("x:ClientData/@ObjectType", NameSpaceManager)?.Value;
                ExcelVmlDrawingBase vmlDrawing;
                switch (objectType)
                {
                case "Drop":
                case "List":
                case "Button":
                case "GBox":
                case "Label":
                case "Checkbox":
                case "Spin":
                case "Radio":
                case "EditBox":
                case "Dialog":
                    vmlDrawing = new ExcelVmlDrawingControl(_ws, node, NameSpaceManager);
                    _drawings.Add(vmlDrawing);
                    break;

                default:        //Comments
                    var rowNode = node.SelectSingleNode("x:ClientData/x:Row", NameSpaceManager);
                    var colNode = node.SelectSingleNode("x:ClientData/x:Column", NameSpaceManager);
                    int row, col;
                    if (rowNode != null && colNode != null)
                    {
                        row = int.Parse(rowNode.InnerText) + 1;
                        col = int.Parse(colNode.InnerText) + 1;
                    }
                    else
                    {
                        row = 1;
                        col = 1;
                    }
                    vmlDrawing = new ExcelVmlDrawingComment(node, ws.Cells[row, col], NameSpaceManager);
                    _drawings.Add(vmlDrawing);
                    _drawingsCellStore.SetValue(row, col, _drawings.Count - 1);
                    break;
                }
                _drawingsDict.Add(string.IsNullOrEmpty(vmlDrawing.SpId) ? vmlDrawing.Id : vmlDrawing.SpId, _drawings.Count - 1);
            }
        }
 internal ExcelVmlDrawingComment Add(ExcelRangeBase cell)
 {
     XmlNode node = AddDrawing(cell);
     var draw = new ExcelVmlDrawingComment(node, cell, NameSpaceManager);            
     _drawings.Add(draw);
     return draw;
 }