protected void AddDrawingsFromXml(ExcelWorksheet ws) { var nodes = VmlDrawingXml.SelectNodes("//v:shape", NameSpaceManager); var list = new List <IRangeID>(); foreach (XmlNode node in nodes) { var rowNode = node.SelectSingleNode("x:ClientData/x:Row", NameSpaceManager); var colNode = node.SelectSingleNode("x:ClientData/x:Column", NameSpaceManager); if (rowNode != null && colNode != null) { var row = int.Parse(rowNode.InnerText) + 1; var col = int.Parse(colNode.InnerText) + 1; list.Add(new ExcelVmlDrawingComment(node, ws.Cells[row, col], NameSpaceManager)); } else { list.Add(new ExcelVmlDrawingComment(node, ws.Cells[1, 1], NameSpaceManager)); } } list.Sort(new Comparison <IRangeID>((r1, r2) => (r1.RangeID <r2.RangeID ? -1 : r1.RangeID> r2.RangeID ? 1 : 0))); //Vml drawings are not sorted. Sort to avoid missmatches. _drawings = new RangeCollection(list); }