Esempio n. 1
0
        private XmlNode AddDrawing(ExcelRangeBase cell)
        {
            int row = cell.Start.Row, col = cell.Start.Column;
            var node = VmlDrawingXml.CreateElement("v", "shape", ExcelPackage.schemaMicrosoftVml);

            var id = ExcelCellBase.GetCellID(cell.Worksheet.SheetID, cell._fromRow, cell._fromCol);
            var ix = _drawings.IndexOf(id);

            if (ix < 0 && (~ix < _drawings.Count))
            {
                ix = ~ix;
                var prevDraw   = _drawings[ix] as ExcelVmlDrawingBase;
                var parentNode = prevDraw.TopNode.ParentNode;
                if (parentNode != null)
                {
                    parentNode.InsertBefore(node, prevDraw.TopNode);
                }
                else
                {
                    VmlDrawingXml.DocumentElement.AppendChild(node);
                }
            }
            else
            {
                VmlDrawingXml.DocumentElement.AppendChild(node);
            }

            node.SetAttribute("id", GetNewId());
            node.SetAttribute("type", "#_x0000_t202");
            node.SetAttribute("style", "position:absolute;z-index:1; visibility:hidden");
            //node.SetAttribute("style", "position:absolute; margin-left:59.25pt;margin-top:1.5pt;width:108pt;height:59.25pt;z-index:1; visibility:hidden");
            node.SetAttribute("fillcolor", "#ffffe1");
            node.SetAttribute("insetmode", ExcelPackage.schemaMicrosoftOffice, "auto");

            string vml = "<v:fill color2=\"#ffffe1\" />";

            vml += "<v:shadow on=\"t\" color=\"black\" obscured=\"t\" />";
            vml += "<v:path o:connecttype=\"none\" />";
            vml += "<v:textbox style=\"mso-direction-alt:auto\">";
            vml += "<div style=\"text-align:left\" />";
            vml += "</v:textbox>";
            vml += "<x:ClientData ObjectType=\"Note\">";
            vml += "<x:MoveWithCells />";
            vml += "<x:SizeWithCells />";
            vml += string.Format("<x:Anchor>{0}, 15, {1}, 2, {2}, 31, {3}, 1</x:Anchor>", col, row - 1, col + 2, row + 3);
            vml += "<x:AutoFill>False</x:AutoFill>";
            vml += string.Format("<x:Row>{0}</x:Row>", row - 1);;
            vml += string.Format("<x:Column>{0}</x:Column>", col - 1);
            vml += "</x:ClientData>";

            node.InnerXml = vml;
            return(node);
        }
Esempio n. 2
0
        public void IndexOf ()
        {
            RangeCollection range = new RangeCollection ();

            range.Add (0);
            range.Add (2);
            range.Add (3);
            range.Add (5);
            range.Add (6);
            range.Add (7);
            range.Add (8);
            range.Add (11);
            range.Add (12);
            range.Add (13);

            Assert.AreEqual (0, range.IndexOf (0));
            Assert.AreEqual (1, range.IndexOf (2));
            Assert.AreEqual (2, range.IndexOf (3));
            Assert.AreEqual (3, range.IndexOf (5));
            Assert.AreEqual (4, range.IndexOf (6));
            Assert.AreEqual (5, range.IndexOf (7));
            Assert.AreEqual (6, range.IndexOf (8));
            Assert.AreEqual (7, range.IndexOf (11));
            Assert.AreEqual (8, range.IndexOf (12));
            Assert.AreEqual (9, range.IndexOf (13));
            Assert.AreEqual (-1, range.IndexOf (99));
        }
Esempio n. 3
0
        public void IndexOf()
        {
            RangeCollection range = new RangeCollection();

            range.Add(0);
            range.Add(2);
            range.Add(3);
            range.Add(5);
            range.Add(6);
            range.Add(7);
            range.Add(8);
            range.Add(11);
            range.Add(12);
            range.Add(13);

            Assert.AreEqual(0, range.IndexOf(0));
            Assert.AreEqual(1, range.IndexOf(2));
            Assert.AreEqual(2, range.IndexOf(3));
            Assert.AreEqual(3, range.IndexOf(5));
            Assert.AreEqual(4, range.IndexOf(6));
            Assert.AreEqual(5, range.IndexOf(7));
            Assert.AreEqual(6, range.IndexOf(8));
            Assert.AreEqual(7, range.IndexOf(11));
            Assert.AreEqual(8, range.IndexOf(12));
            Assert.AreEqual(9, range.IndexOf(13));
            Assert.AreEqual(-1, range.IndexOf(99));
        }
Esempio n. 4
0
        public void IndexOf()
        {
            var range = new RangeCollection {
                0,
                2,
                3,
                5,
                6,
                7,
                8,
                11,
                12,
                13
            };

            Assert.AreEqual(0, range.IndexOf(0));
            Assert.AreEqual(1, range.IndexOf(2));
            Assert.AreEqual(2, range.IndexOf(3));
            Assert.AreEqual(3, range.IndexOf(5));
            Assert.AreEqual(4, range.IndexOf(6));
            Assert.AreEqual(5, range.IndexOf(7));
            Assert.AreEqual(6, range.IndexOf(8));
            Assert.AreEqual(7, range.IndexOf(11));
            Assert.AreEqual(8, range.IndexOf(12));
            Assert.AreEqual(9, range.IndexOf(13));
            Assert.AreEqual(-1, range.IndexOf(99));
        }