Beispiel #1
0
        public void ShapeSheet_Query_Demo_AllCellsAndSections()
        {
            var doc1  = this.GetNewDoc();
            var page1 = doc1.Pages[1];

            VisioAutomationTest.SetPageSize(page1, this.StandardPageSize);

            // draw simple shapes
            var s1 = page1.DrawRectangle(0, 0, 1, 1);
            var s2 = page1.DrawRectangle(2, 2, 3, 3);


            var query = new VA.ShapeSheet.Query.CellQuery();

            var name_to_src         = VA.ShapeSheet.SRCConstants.GetSRCDictionary();
            var section_to_secquery = new Dictionary <short, VA.ShapeSheet.Query.CellQuery.SectionQuery>();

            foreach (var kv in name_to_src)
            {
                var name = kv.Key;
                var src  = kv.Value;

                if (src.Section == (short)IVisio.VisSectionIndices.visSectionObject)
                {
                    query.Columns.Add(src, name);
                }
                else if ((src.Section == (short)IVisio.VisSectionIndices.visSectionFirst) ||
                         (src.Section == (short)IVisio.VisSectionIndices.visSectionFirstComponent) ||
                         (src.Section == (short)IVisio.VisSectionIndices.visSectionLast) ||
                         (src.Section == (short)IVisio.VisSectionIndices.visSectionInval) ||
                         (src.Section == (short)IVisio.VisSectionIndices.visSectionNone) ||
                         (src.Section == (short)IVisio.VisSectionIndices.visSectionFirst) ||
                         (src.Section == (short)IVisio.VisSectionIndices.visSectionLastComponent)
                         )
                {
                    //skip
                }
                else
                {
                    VA.ShapeSheet.Query.CellQuery.SectionQuery sec;
                    if (!section_to_secquery.ContainsKey(src.Section))
                    {
                        sec = query.Sections.Add((IVisio.VisSectionIndices)src.Section);
                        section_to_secquery[src.Section] = sec;
                    }
                    else
                    {
                        sec = section_to_secquery[src.Section];
                    }
                    sec.Columns.Add(src.Cell, name);
                }
            }

            var formulas1 = query.GetFormulas(s1);
            var formulas2 = query.GetFormulas(page1, new [] { s1.ID, s2.ID });

            doc1.Close(true);
        }
        public void ShapeSheet_Query_Demo_AllCellsAndSections()
        {
            var doc1 = this.GetNewDoc();
            var page1 = doc1.Pages[1];
            VisioAutomationTest.SetPageSize(page1, this.StandardPageSize);

            // draw simple shapes
            var s1 = page1.DrawRectangle(0,0,1,1);
            var s2 = page1.DrawRectangle(2,2,3,3);

            var query = new VA.ShapeSheet.Query.CellQuery();

            var name_to_src = VA.ShapeSheet.SRCConstants.GetSRCDictionary();
            var section_to_secquery = new Dictionary<short,VA.ShapeSheet.Query.SectionColumn>();

            foreach (var kv in name_to_src)
            {
                var name = kv.Key;
                var src = kv.Value;

                if (src.Section == (short) IVisio.VisSectionIndices.visSectionObject)
                {
                    query.AddCell(src, name);
                }
                else if ((src.Section == (short) IVisio.VisSectionIndices.visSectionFirst)
                         || (src.Section == (short) IVisio.VisSectionIndices.visSectionFirstComponent)
                         || (src.Section == (short) IVisio.VisSectionIndices.visSectionLast)
                         || (src.Section == (short) IVisio.VisSectionIndices.visSectionInval)
                         || (src.Section == (short) IVisio.VisSectionIndices.visSectionNone)
                         || (src.Section == (short) IVisio.VisSectionIndices.visSectionFirst)
                         || (src.Section == (short) IVisio.VisSectionIndices.visSectionLastComponent)
                    )
                {
                    //skip
                }
                else
                {
                    VA.ShapeSheet.Query.SectionColumn sec;
                    if (!section_to_secquery.ContainsKey(src.Section))
                    {
                        sec = query.AddSection((IVisio.VisSectionIndices)src.Section);
                        section_to_secquery[src.Section] = sec;
                    }
                    else
                    {
                        sec = section_to_secquery[src.Section];
                    }
                    sec.AddCell(src.Cell, name);
                }
            }

            var formulas1 = query.GetFormulas(s1);
            var formulas2 = query.GetFormulas(page1,new [] {s1.ID,s2.ID});

            doc1.Close(true);
        }
        public void ShapeSheet_Query_Demo_AllCellsAndSections()
        {
            var doc1  = this.GetNewDoc();
            var page1 = doc1.Pages[1];

            VisioAutomationTest.SetPageSize(page1, this.StandardPageSize);

            // draw simple shapes
            var s1 = page1.DrawRectangle(0, 0, 1, 1);
            var s2 = page1.DrawRectangle(2, 2, 3, 3);


            var query = new VA.ShapeSheet.Query.CellQuery();

            var name_to_src         = VA.ShapeSheet.SRCConstants.GetSRCDictionary();
            var section_to_secquery = new Dictionary <short, VA.ShapeSheet.Query.SectionColumn>();

            foreach (var kv in name_to_src)
            {
                var name = kv.Key;
                var src  = kv.Value;

                // Ignore Sections we don't care about
                if (section_is_skippable(src))
                {
                    continue;
                }

                if (src.Section == (short)IVisio.VisSectionIndices.visSectionObject)
                {
                    query.AddCell(src, name);
                }
                else
                {
                    VA.ShapeSheet.Query.SectionColumn sec_col;
                    if (!section_to_secquery.ContainsKey(src.Section))
                    {
                        sec_col = query.AddSection((IVisio.VisSectionIndices)src.Section);
                        section_to_secquery[src.Section] = sec_col;
                    }
                    else
                    {
                        sec_col = section_to_secquery[src.Section];
                    }
                    sec_col.AddCell(src.Cell, name);
                }
            }

            var formulas1 = query.GetFormulas(s1);
            var formulas2 = query.GetFormulas(page1, new [] { s1.ID, s2.ID });

            doc1.Close(true);
        }
        public void ShapeSheet_Writer_ResultsString_SingleShape()
        {
            var page1  = this.GetNewPage();
            var shape1 = page1.DrawRectangle(0, 0, 1, 1);

            // Setup the modifications to the cell values
            var writer = new VASS.Writers.SrcWriter();

            writer.SetValue(LinePattern, "7");
            writer.Commit(shape1, VASS.CellValueType.Formula);

            // Build the query
            var query       = new VASS.Query.CellQuery();
            var col_linepat = query.Columns.Add(LinePattern, nameof(LinePattern));

            // Retrieve the values
            var data_formulas = query.GetFormulas(shape1);
            var data_results  = query.GetResults <double>(shape1);

            int rownum = 0;

            // Verify
            Assert.AreEqual("7", data_formulas[rownum][col_linepat]);
            Assert.AreEqual(7, data_results[rownum][col_linepat]);
            page1.Delete(0);
        }
Beispiel #5
0
        public VA.ShapeSheet.Query.CellQuery.QueryResultList <string> QueryFormulas(IList <IVisio.Shape> target_shapes, IList <VA.ShapeSheet.SRC> srcs)
        {
            this.AssertApplicationAvailable();
            this.AssertDocumentAvailable();

            var shapes   = this.GetTargetShapes(target_shapes);
            var shapeids = shapes.Select(s => s.ID).ToList();

            var surface = this.Client.Draw.GetDrawingSurfaceSafe();

            var query = new VA.ShapeSheet.Query.CellQuery();

            int ci = 0;

            foreach (var src in srcs)
            {
                string colname = string.Format("Col{0}", ci);
                query.Columns.Add(src, colname);
                ci++;
            }

            var formulas = query.GetFormulas(surface, shapeids);

            return(formulas);
        }
Beispiel #6
0
 public static System.Data.DataTable QueryToDataTable(VA.ShapeSheet.Query.CellQuery cellQuery, bool getresults, ResultType ResultType, IList <int> shapeids, VA.Drawing.DrawingSurface surface)
 {
     if (getresults)
     {
         if (ResultType == ResultType.String)
         {
             var output = cellQuery.GetResults <string>(surface, shapeids);
             return(Helpers.querytable_to_datatable(cellQuery, output));
         }
         else if (ResultType == ResultType.Boolean)
         {
             var output = cellQuery.GetResults <bool>(surface, shapeids);
             return(Helpers.querytable_to_datatable(cellQuery, output));
         }
         else if (ResultType == ResultType.Double)
         {
             var output = cellQuery.GetResults <double>(surface, shapeids);
             return(Helpers.querytable_to_datatable(cellQuery, output));
         }
         else if (ResultType == ResultType.Integer)
         {
             var output = cellQuery.GetResults <int>(surface, shapeids);
             return(Helpers.querytable_to_datatable(cellQuery, output));
         }
         else
         {
             throw new VA.Scripting.VisioApplicationException("Unsupported Result type");
         }
     }
     else
     {
         var output = cellQuery.GetFormulas(surface, shapeids);
         return(Helpers.querytable_to_datatable(cellQuery, output));
     }
 }
Beispiel #7
0
        public VA.ShapeSheet.Query.CellQuery.QueryResultList <string> QueryFormulas(IList <IVisio.Shape> target_shapes, IVisio.VisSectionIndices section, IList <IVisio.VisCellIndices> cells)
        {
            this.AssertApplicationAvailable();
            this.AssertDocumentAvailable();

            var shapes   = this.GetTargetShapes(target_shapes);
            var shapeids = shapes.Select(s => s.ID).ToList();

            var surface = this.Client.Draw.GetDrawingSurfaceSafe();

            var query = new VA.ShapeSheet.Query.CellQuery();
            var sec   = query.Sections.Add(section);

            int ci = 0;

            foreach (var cell in cells)
            {
                string name = string.Format("Cell{0}", ci);
                sec.Columns.Add((short)cell, name);
                ci++;
            }

            var formulas = query.GetFormulas(surface, shapeids);

            return(formulas);
        }
        public void ShapeSheet_Query_GetResults_SingleShape()
        {
            var doc1  = this.GetNewDoc();
            var page1 = doc1.Pages[1];

            VisioAutomationTest.SetPageSize(page1, this.StandardPageSize);

            // draw a simple shape
            var s1    = page1.DrawRectangle(this.StandardPageSizeRect);
            int s1_id = s1.ID;

            // format it with setformulas
            var fg_cell  = s1.Cells["FillForegnd"];
            var bg_cell  = s1.Cells["FillBkgnd"];
            var pat_cell = s1.Cells["FillPattern"];

            fg_cell.FormulaU  = "RGB(255,0,0)";
            bg_cell.FormulaU  = "RGB(0,0,255)";
            pat_cell.FormulaU = "40";

            // now retrieve the formulas with GetFormulas

            var query      = new VA.ShapeSheet.Query.CellQuery();
            var col_fg     = query.Columns.Add(SrcConstants.FillForeground, nameof(SrcConstants.FillForeground));
            var col_bg     = query.Columns.Add(SrcConstants.FillBackground, nameof(SrcConstants.FillBackground));
            var col_filpat = query.Columns.Add(SrcConstants.FillPattern, nameof(SrcConstants.FillPattern));

            var shapeids = new[] { s1_id };

            var formulas = query.GetFormulas(page1, shapeids);

            // now verify that the formulas were actually set
            Assert.AreEqual("RGB(255,0,0)", formulas[0].Cells[col_fg]);
            Assert.AreEqual("RGB(0,0,255)", formulas[0].Cells[col_bg]);
            Assert.AreEqual("40", formulas[0].Cells[col_filpat]);

            // now retrieve the results with GetResults as floats
            var float_results = query.GetResults <double>(page1, shapeids);

            Assert.IsNotNull(float_results);
            Assert.AreEqual(40.0, float_results[0].Cells[col_filpat]);

            // now retrieve the results with GetResults as ints
            var int_results = query.GetResults <int>(page1, shapeids);

            Assert.AreEqual(40, int_results[0].Cells[col_filpat]);

            // now retrieve the results with GetResults as strings

            var string_results = query.GetResults <string>(page1, shapeids);

            Assert.AreEqual("RGB(255, 0, 0)", string_results[0].Cells[col_fg]);
            Assert.AreEqual("RGB(0, 0, 255)", string_results[0].Cells[col_bg]);
            Assert.AreEqual("40", string_results[0].Cells[col_filpat]);

            page1.Delete(0);
            doc1.Close(true);
        }
        public void ShapeSheet_Query_GetResults_MultipleShapes()
        {
            var page1 = this.GetNewPage();

            // draw a simple shape
            var s1    = page1.DrawRectangle(this.StandardPageSizeRect);
            int s1_id = s1.ID;

            // format it with setformulas
            var fg_cell  = s1.Cells["FillForegnd"];
            var bg_cell  = s1.Cells["FillBkgnd"];
            var pat_cell = s1.Cells["FillPattern"];

            fg_cell.ResultIU  = 2.0; //red
            bg_cell.ResultIU  = 3.0; //green
            pat_cell.ResultIU = 40.0;

            // now retrieve the formulas with GetFormulas

            var query      = new VA.ShapeSheet.Query.CellQuery();
            var col_fg     = query.Columns.Add(SrcConstants.FillForeground, nameof(SrcConstants.FillForeground));
            var col_bg     = query.Columns.Add(SrcConstants.FillBackground, nameof(SrcConstants.FillBackground));
            var col_filpat = query.Columns.Add(SrcConstants.FillPattern, nameof(SrcConstants.FillPattern));

            var shapeids = new[] { s1_id };

            var formulas = query.GetFormulas(page1, shapeids);

            // now verify that the formulas were actually set
            Assert.AreEqual("2", formulas[0].Cells[col_fg]);
            Assert.AreEqual("3", formulas[0].Cells[col_bg]);
            Assert.AreEqual("40", formulas[0].Cells[col_filpat]);

            // now retrieve the results with GetResults as floats
            var float_results = query.GetResults <double>(page1, shapeids);

            Assert.AreEqual(2.0, float_results[0].Cells[col_fg]);
            Assert.AreEqual(3.0, float_results[0].Cells[col_bg]);
            Assert.AreEqual(40.0, float_results[0].Cells[col_filpat]);

            // now retrieve the results with GetResults as ints
            var int_results = query.GetResults <int>(page1, shapeids);

            Assert.AreEqual(2, int_results[0].Cells[col_fg]);
            Assert.AreEqual(3, int_results[0].Cells[col_bg]);
            Assert.AreEqual(40, int_results[0].Cells[col_filpat]);

            // now retrieve the results with GetResults as strings
            var string_results = query.GetResults <string>(page1, shapeids);

            Assert.AreEqual("2", string_results[0].Cells[col_fg]);
            Assert.AreEqual("3", string_results[0].Cells[col_bg]);
            Assert.AreEqual("40", string_results[0].Cells[col_filpat]);

            page1.Delete(0);
        }
        public void ShapeSheet_Query_Demo_MultipleShapes_Verify_Out_Of_order()
        {
            var page1 = this.GetNewPage(new VisioAutomation.Geometry.Size(10, 10));

            // draw a simple shape
            var sa = page1.DrawRectangle(-1, -1, 0, 0);
            var s1 = page1.DrawRectangle(0, 0, 2, 2);
            var sb = page1.DrawRectangle(-1, -1, 0, 0);
            var s2 = page1.DrawRectangle(4, 4, 6, 6);
            var s3 = page1.DrawRectangle(5, 5, 7, 7);

            // notice that the shapes are created as 0, 1,2,3
            // but are queried as 2, 3, 1
            var shapeids = new List <int> {
                s2.ID, s3.ID, s1.ID
            };

            Assert.AreEqual(5, page1.Shapes.Count);

            var query    = new VA.ShapeSheet.Query.CellQuery();
            var col_pinx = query.Columns.Add(SrcConstants.XFormPinX, nameof(SrcConstants.XFormPinX));
            var col_piny = query.Columns.Add(SrcConstants.XFormPinY, nameof(SrcConstants.XFormPinY));

            var data_formulas = query.GetFormulas(page1, shapeids);
            var data_results  = query.GetResults <double>(page1, shapeids);

            var expected_formulas = new[, ]
            {
                { "5 in", "5 in" },
                { "6 in", "6 in" },
                { "1 in", "1 in" }
            };

            var expected_results = new[, ]
            {
                { 5.0, 5.0 },
                { 6.0, 6.0 },
                { 1.0, 1.0 }
            };


            for (int row = 0; row < data_results.Count; row++)
            {
                for (int col = 0; col < query.Columns.Count; col++)
                {
                    Assert.AreEqual(expected_formulas[row, col], data_formulas[row].Cells[col]);
                    Assert.AreEqual(expected_results[row, col], data_results[row].Cells[col]);
                }
            }

            page1.Delete(0);
        }
Beispiel #11
0
        public void ShapeSheet_Query_Demo_MultipleShapes()
        {
            var page1 = GetNewPage(new VA.Drawing.Size(10, 10));

            // draw a simple shape
            var s1 = page1.DrawRectangle(0, 0, 2, 2);
            var s2 = page1.DrawRectangle(4, 4, 6, 6);
            var s3 = page1.DrawRectangle(5, 5, 7, 7);

            var shapeids = new List <int> {
                s1.ID, s2.ID, s3.ID
            };

            Assert.AreEqual(3, page1.Shapes.Count);

            var query    = new VA.ShapeSheet.Query.CellQuery();
            var col_pinx = query.Columns.Add(VA.ShapeSheet.SRCConstants.PinX, "PinX");
            var col_piny = query.Columns.Add(VA.ShapeSheet.SRCConstants.PinY, "PinY");

            var rf = query.GetFormulas(page1, shapeids);
            var rr = query.GetResults <double>(page1, shapeids);

            var expected_formulas = new[, ]
            {
                { "1 in", "1 in" },
                { "5 in", "5 in" },
                { "6 in", "6 in" }
            };

            var expected_results = new[, ]
            {
                { 1.0, 1.0 },
                { 5.0, 5.0 },
                { 6.0, 6.0 }
            };


            for (int row = 0; row < rr.Count; row++)
            {
                for (int col = 0; col < query.Columns.Count; col++)
                {
                    Assert.AreEqual(expected_formulas[row, col], rf[row][col]);
                    Assert.AreEqual(expected_results[row, col], rr[row][col]);
                }
            }

            page1.Delete(0);
        }
        public static DataTable QueryToDataTable(
            VASS.Query.CellQuery query,
            VisioAutomation.ShapeSheet.CellValueType value_type,
            Models.ResultType result_type,
            IList <int> shapeids,
            VisioAutomation.SurfaceTarget surface)
        {
            if (value_type == VASS.CellValueType.Formula)
            {
                var output = query.GetFormulas(surface, shapeids);
                var dt     = DataTableHelpers.querytable_to_datatable(query, output);
                return(dt);
            }

            if (value_type != VASS.CellValueType.Result)
            {
                throw new System.ArgumentOutOfRangeException(nameof(value_type));
            }

            if (result_type == ResultType.String)
            {
                var output = query.GetResults <string>(surface, shapeids);
                return(DataTableHelpers.querytable_to_datatable(query, output));
            }
            else if (result_type == ResultType.Bool)
            {
                var output = query.GetResults <string>(surface, shapeids);
                return(DataTableHelpers.querytable_to_datatable(query, output));
            }
            else if (result_type == ResultType.Double)
            {
                var output = query.GetResults <double>(surface, shapeids);
                return(DataTableHelpers.querytable_to_datatable(query, output));
            }
            else if (result_type == ResultType.Int)
            {
                var output = query.GetResults <int>(surface, shapeids);
                return(DataTableHelpers.querytable_to_datatable(query, output));
            }
            else
            {
                string msg = string.Format("Unsupported value of \"{0}\" for type {1}", result_type, nameof(result_type));
                throw new System.ArgumentOutOfRangeException(nameof(result_type), msg);
            }
        }
Beispiel #13
0
        public static DataTable QueryToDataTable(
            VASS.Query.CellQuery query,
            CellOutputType output_type,
            IList <int> shapeids,
            VisioAutomation.SurfaceTarget surface)
        {
            switch (output_type)
            {
            case CellOutputType.Formula:
            {
                var output = query.GetFormulas(surface, shapeids);
                var dt     = DataTableHelpers.querytable_to_datatable(query, output);
                return(dt);
            }

            case CellOutputType.ResultString:
            {
                var output = query.GetResults <string>(surface, shapeids);
                return(DataTableHelpers.querytable_to_datatable(query, output));
            }

            case CellOutputType.ResultBoolean:
            {
                var output = query.GetResults <bool>(surface, shapeids);
                return(DataTableHelpers.querytable_to_datatable(query, output));
            }

            case CellOutputType.ResultDouble:
            {
                var output = query.GetResults <double>(surface, shapeids);
                return(DataTableHelpers.querytable_to_datatable(query, output));
            }

            case CellOutputType.ResultInteger:
            {
                var output = query.GetResults <int>(surface, shapeids);
                return(DataTableHelpers.querytable_to_datatable(query, output));
            }
            }

            string msg = string.Format("Unsupported value of \"{0}\" for type {1}", output_type, nameof(CellOutputType));

            throw new System.ArgumentOutOfRangeException(nameof(output_type), msg);
        }
        public void UserDefinedCells_GetFromMultipleShapes_WithAdditionalProps()
        {
            var page1 = this.GetNewPage();

            var s1 = page1.DrawRectangle(0, 0, 1, 1);
            var s2 = page1.DrawRectangle(1, 1, 2, 2);
            var shapes = new[] { s1, s2 };

            VAUSERCELL.UserDefinedCellsHelper.Set(s1, "foo", "bar", null);

            var queryex = new VisioAutomation.ShapeSheet.Query.CellQuery();
            var sec = queryex.AddSection(IVisio.VisSectionIndices.visSectionUser);
            var Value = sec.AddCell(VisioAutomation.ShapeSheet.SRCConstants.User_Value,"Value");
            var Prompt = sec.AddCell(VisioAutomation.ShapeSheet.SRCConstants.User_Prompt,"Prompt");

            var formulas = queryex.GetFormulas(page1, shapes.Select(s => s.ID).ToList());

            page1.Delete(0);
        }
Beispiel #15
0
        public void UserDefinedCells_GetFromMultipleShapes_WithAdditionalProps()
        {
            var page1 = GetNewPage();

            var s1     = page1.DrawRectangle(0, 0, 1, 1);
            var s2     = page1.DrawRectangle(1, 1, 2, 2);
            var shapes = new[] { s1, s2 };

            VAUSERCELL.UserDefinedCellsHelper.Set(s1, "foo", "bar", null);

            var queryex = new VA.ShapeSheet.Query.CellQuery();
            var sec     = queryex.Sections.Add(IVisio.VisSectionIndices.visSectionUser);
            var Value   = sec.Columns.Add(VA.ShapeSheet.SRCConstants.User_Value, "Value");
            var Prompt  = sec.Columns.Add(VA.ShapeSheet.SRCConstants.User_Prompt, "Prompt");

            var formulas = queryex.GetFormulas(page1, shapes.Select(s => s.ID).ToList());


            page1.Delete(0);
        }
        public void ShapeSheet_Writer_Formulas_MultipleShapes()
        {
            var page1 = this.GetNewPage();

            var shape1 = page1.DrawRectangle(-1, -1, 0, 0);
            var shape2 = page1.DrawRectangle(-1, -1, 0, 0);
            var shape3 = page1.DrawRectangle(-1, -1, 0, 0);


            // Set the formulas
            var writer = new VASS.Writers.SidSrcWriter();

            writer.SetValue(shape1.ID16, XFormPinX, 0.5);
            writer.SetValue(shape1.ID16, XFormPinY, 0.5);
            writer.SetValue(shape2.ID16, XFormPinX, 1.5);
            writer.SetValue(shape2.ID16, XFormPinY, 1.5);
            writer.SetValue(shape3.ID16, XFormPinX, 2.5);
            writer.SetValue(shape3.ID16, XFormPinY, 2.5);

            writer.Commit(page1, VASS.CellValueType.Formula);

            // Verify that the formulas were set
            var query    = new VASS.Query.CellQuery();
            var col_pinx = query.Columns.Add(XFormPinX, nameof(XFormPinX));
            var col_piny = query.Columns.Add(XFormPinY, nameof(XFormPinY));

            var shapeids = new[] { shape1.ID, shape2.ID, shape3.ID };

            var data_formulas = query.GetFormulas(page1, shapeids);
            var data_results  = query.GetResults <double>(page1, shapeids);

            AssertUtil.AreEqual(("0.5 in", 0.5), (data_formulas[0][col_pinx], data_results[0][col_pinx]));
            AssertUtil.AreEqual(("0.5 in", 0.5), (data_formulas[0][col_piny], data_results[0][col_piny]));
            AssertUtil.AreEqual(("1.5 in", 1.5), (data_formulas[1][col_pinx], data_results[1][col_pinx]));
            AssertUtil.AreEqual(("1.5 in", 1.5), (data_formulas[1][col_piny], data_results[1][col_piny]));
            AssertUtil.AreEqual(("2.5 in", 2.5), (data_formulas[2][col_pinx], data_results[2][col_pinx]));
            AssertUtil.AreEqual(("2.5 in", 2.5), (data_formulas[2][col_piny], data_results[2][col_piny]));

            page1.Delete(0);
        }
Beispiel #17
0
        public void ShapeSheet_Update_ResultsDouble_MultipleShapes()
        {
            var page1 = GetNewPage();

            var shape1 = page1.DrawRectangle(-1, -1, 0, 0);
            var shape2 = page1.DrawRectangle(-1, -1, 0, 0);
            var shape3 = page1.DrawRectangle(-1, -1, 0, 0);


            // Set the formulas
            var update = new VA.ShapeSheet.Update();

            update.SetResult(shape1.ID16, src_pinx, 0.5, IVisio.VisUnitCodes.visNumber);
            update.SetResult(shape1.ID16, src_piny, 0.5, IVisio.VisUnitCodes.visNumber);
            update.SetResult(shape2.ID16, src_pinx, 1.5, IVisio.VisUnitCodes.visNumber);
            update.SetResult(shape2.ID16, src_piny, 1.5, IVisio.VisUnitCodes.visNumber);
            update.SetResult(shape3.ID16, src_pinx, 2.5, IVisio.VisUnitCodes.visNumber);
            update.SetResult(shape3.ID16, src_piny, 2.5, IVisio.VisUnitCodes.visNumber);
            update.Execute(page1);

            // Verify that the formulas were set
            var query    = new VA.ShapeSheet.Query.CellQuery();
            var col_pinx = query.Columns.Add(src_pinx, "PinX");
            var col_piny = query.Columns.Add(src_piny, "PinY");

            var shapeids = new[] { shape1.ID, shape2.ID, shape3.ID };

            var rf = query.GetFormulas(page1, shapeids);
            var rr = query.GetResults <double>(page1, shapeids);

            AssertVA.AreEqual("0.5 in", 0.5, rf[0][col_pinx.Ordinal], rr[0][col_pinx.Ordinal]);
            AssertVA.AreEqual("0.5 in", 0.5, rf[0][col_piny.Ordinal], rr[0][col_piny.Ordinal]);
            AssertVA.AreEqual("1.5 in", 1.5, rf[1][col_pinx.Ordinal], rr[1][col_pinx.Ordinal]);
            AssertVA.AreEqual("1.5 in", 1.5, rf[1][col_piny.Ordinal], rr[1][col_piny.Ordinal]);
            AssertVA.AreEqual("2.5 in", 2.5, rf[2][col_pinx.Ordinal], rr[2][col_pinx.Ordinal]);
            AssertVA.AreEqual("2.5 in", 2.5, rf[2][col_piny.Ordinal], rr[2][col_piny.Ordinal]);

            page1.Delete(0);
        }
        public void ShapeSheet_Update_Formulas_MultipleShapes()
        {
            var page1 = this.GetNewPage();

            var shape1 = page1.DrawRectangle(-1, -1, 0, 0);
            var shape2 = page1.DrawRectangle(-1, -1, 0, 0);
            var shape3 = page1.DrawRectangle(-1, -1, 0, 0);


            // Set the formulas
            var update = new VA.ShapeSheet.Update();

            update.SetFormula(shape1.ID16, ShapeSheet_Update_Tests.src_pinx, 0.5);
            update.SetFormula(shape1.ID16, ShapeSheet_Update_Tests.src_piny, 0.5);
            update.SetFormula(shape2.ID16, ShapeSheet_Update_Tests.src_pinx, 1.5);
            update.SetFormula(shape2.ID16, ShapeSheet_Update_Tests.src_piny, 1.5);
            update.SetFormula(shape3.ID16, ShapeSheet_Update_Tests.src_pinx, 2.5);
            update.SetFormula(shape3.ID16, ShapeSheet_Update_Tests.src_piny, 2.5);
            update.Execute(page1);

            // Verify that the formulas were set
            var query    = new VA.ShapeSheet.Query.CellQuery();
            var col_pinx = query.AddCell(ShapeSheet_Update_Tests.src_pinx, "PinX");
            var col_piny = query.AddCell(ShapeSheet_Update_Tests.src_piny, "PinY");

            var shapeids = new[] { shape1.ID, shape2.ID, shape3.ID };

            var rf = query.GetFormulas(page1, shapeids);
            var rr = query.GetResults <double>(page1, shapeids);

            AssertVA.AreEqual("0.5 in", 0.5, rf[0][col_pinx], rr[0][col_pinx]);
            AssertVA.AreEqual("0.5 in", 0.5, rf[0][col_piny], rr[0][col_piny]);
            AssertVA.AreEqual("1.5 in", 1.5, rf[1][col_pinx], rr[1][col_pinx]);
            AssertVA.AreEqual("1.5 in", 1.5, rf[1][col_piny], rr[1][col_piny]);
            AssertVA.AreEqual("2.5 in", 2.5, rf[2][col_pinx], rr[2][col_pinx]);
            AssertVA.AreEqual("2.5 in", 2.5, rf[2][col_piny], rr[2][col_piny]);

            page1.Delete(0);
        }
        public void ShapeSheet_Update_Formulas_MultipleShapes()
        {
            var page1 = this.GetNewPage();

            var shape1 = page1.DrawRectangle(-1, -1, 0, 0);
            var shape2 = page1.DrawRectangle(-1, -1, 0, 0);
            var shape3 = page1.DrawRectangle(-1, -1, 0, 0);


            // Set the formulas
            var update = new VA.ShapeSheet.Update();
            update.SetFormula(shape1.ID16, ShapeSheet_Update_Tests.src_pinx, 0.5);
            update.SetFormula(shape1.ID16, ShapeSheet_Update_Tests.src_piny, 0.5);
            update.SetFormula(shape2.ID16, ShapeSheet_Update_Tests.src_pinx, 1.5);
            update.SetFormula(shape2.ID16, ShapeSheet_Update_Tests.src_piny, 1.5);
            update.SetFormula(shape3.ID16, ShapeSheet_Update_Tests.src_pinx, 2.5);
            update.SetFormula(shape3.ID16, ShapeSheet_Update_Tests.src_piny, 2.5);
            update.Execute(page1);

            // Verify that the formulas were set
            var query = new VA.ShapeSheet.Query.CellQuery();
            var col_pinx = query.AddCell(ShapeSheet_Update_Tests.src_pinx, "PinX");
            var col_piny = query.AddCell(ShapeSheet_Update_Tests.src_piny, "PinY");

            var shapeids = new[] { shape1.ID, shape2.ID, shape3.ID };

            var rf = query.GetFormulas(page1, shapeids);
            var rr = query.GetResults<double>(page1, shapeids);

            AssertVA.AreEqual("0.5 in", 0.5, rf[0][col_pinx], rr[0][col_pinx]);
            AssertVA.AreEqual("0.5 in", 0.5, rf[0][col_piny], rr[0][col_piny]);
            AssertVA.AreEqual("1.5 in", 1.5, rf[1][col_pinx], rr[1][col_pinx]);
            AssertVA.AreEqual("1.5 in", 1.5, rf[1][col_piny], rr[1][col_piny]);
            AssertVA.AreEqual("2.5 in", 2.5, rf[2][col_pinx], rr[2][col_pinx]);
            AssertVA.AreEqual("2.5 in", 2.5, rf[2][col_piny], rr[2][col_piny]);

            page1.Delete(0);
        }
Beispiel #20
0
        public static DataTable QueryToDataTable(VisioAutomation.ShapeSheet.Query.CellQuery cellQuery, bool getresults, Model.ResultType ResultType, IList <int> shapeids, VisioAutomation.ShapeSheet.ShapeSheetSurface surface)
        {
            if (!getresults)
            {
                var output = cellQuery.GetFormulas(surface, shapeids);
                return(Helpers.querytable_to_datatable(cellQuery, output));
            }

            switch (ResultType)
            {
            case Model.ResultType.String:
            {
                var output = cellQuery.GetResults <string>(surface, shapeids);
                return(Helpers.querytable_to_datatable(cellQuery, output));
            }

            case Model.ResultType.Boolean:
            {
                var output = cellQuery.GetResults <bool>(surface, shapeids);
                return(Helpers.querytable_to_datatable(cellQuery, output));
            }

            case Model.ResultType.Double:
            {
                var output = cellQuery.GetResults <double>(surface, shapeids);
                return(Helpers.querytable_to_datatable(cellQuery, output));
            }

            case Model.ResultType.Integer:
            {
                var output = cellQuery.GetResults <int>(surface, shapeids);
                return(Helpers.querytable_to_datatable(cellQuery, output));
            }
            }

            throw new VisioAutomation.Scripting.VisioApplicationException("Unsupported Result type");
        }
        public void ShapeSheet_Query_Demo_MultipleShapes_Verify_Out_Of_order()
        {
            var page1 = this.GetNewPage(new VisioAutomation.Drawing.Size(10, 10));

            // draw a simple shape
            var sa = page1.DrawRectangle(-1, -1, 0, 0);
            var s1 = page1.DrawRectangle(0, 0, 2, 2);
            var sb = page1.DrawRectangle(-1, -1, 0, 0);
            var s2 = page1.DrawRectangle(4, 4, 6, 6);
            var s3 = page1.DrawRectangle(5, 5, 7, 7);

            // notice that the shapes are created as 0, 1,2,3
            // but are queried as 2, 3, 1
            var shapeids = new List<int> { s2.ID, s3.ID, s1.ID };

            Assert.AreEqual(5, page1.Shapes.Count);

            var query = new VA.ShapeSheet.Query.CellQuery();
            var col_pinx = query.AddCell(VA.ShapeSheet.SRCConstants.PinX, "PinX");
            var col_piny = query.AddCell(VA.ShapeSheet.SRCConstants.PinY, "PinY");

            var rf = query.GetFormulas(page1, shapeids);
            var rr = query.GetResults<double>(page1, shapeids);

            var expected_formulas = new[,]
                                      {
                                          {"5 in", "5 in"},
                                          {"6 in", "6 in"},
                                          {"1 in", "1 in"}
                                      };

            var expected_results = new[,]
                                      {
                                          {5.0, 5.0},
                                          {6.0, 6.0},
                                          {1.0, 1.0}
                                      };


            for (int row = 0; row < rr.Count; row++)
            {
                for (int col = 0; col < query.CellColumns.Count; col++)
                {
                    Assert.AreEqual(expected_formulas[row, col], rf[row][col]);
                    Assert.AreEqual(expected_results[row, col], rr[row][col]);
                }
            }

            page1.Delete(0);
        }
Beispiel #22
0
        public static void Duplicate(
            IVisio.Page src_page,
            IVisio.Page dest_page)
        {
            init_page_srcs();

            var   app = src_page.Application;
            short copy_paste_flags = (short)IVisio.VisCutCopyPasteCodes.visCopyPasteNoTranslate;

            // handle the source page
            if (src_page == null)
            {
                throw new System.ArgumentNullException(nameof(src_page));
            }

            if (dest_page == null)
            {
                throw new System.ArgumentNullException(nameof(dest_page));
            }

            if (dest_page == src_page)
            {
                throw new System.ArgumentException("Destination Page cannot be Source Page");
            }


            if (src_page != app.ActivePage)
            {
                throw new System.ArgumentException("Source page must be active page.");
            }

            var src_page_shapes = src_page.Shapes;
            int num_src_shapes  = src_page_shapes.Count;

            if (num_src_shapes > 0)
            {
                var active_window = app.ActiveWindow;
                active_window.SelectAll();
                var selection = active_window.Selection;
                selection.Copy(copy_paste_flags);
                active_window.DeselectAll();
            }

            // Get the Cells from the Source
            var query = new VASS.Query.CellQuery();
            int i     = 0;

            foreach (var src in _static_page_srcs)
            {
                query.Columns.Add(src, "Col" + i.ToString());
                i++;
            }

            var src_formulas = query.GetFormulas(src_page.PageSheet);

            // Set the Cells on the Destination

            var writer = new VASS.Writers.SrcWriter();

            for (i = 0; i < _static_page_srcs.Count; i++)
            {
                int row = 0;
                writer.SetValue(_static_page_srcs[i], src_formulas[row][i]);
            }

            writer.Commit(dest_page.PageSheet, VASS.CellValueType.Formula);

            // make sure the new page looks like the old page
            dest_page.Background = src_page.Background;

            // then paste any contents from the first page
            if (num_src_shapes > 0)
            {
                dest_page.Paste(copy_paste_flags);
            }
        }
Beispiel #23
0
        public void ShapeSheet_Query_GetResults_SingleShape()
        {
            var doc1  = this.GetNewDoc();
            var page1 = doc1.Pages[1];

            VisioAutomationTest.SetPageSize(page1, this.StandardPageSize);

            // draw a simple shape
            var s1    = page1.DrawRectangle(this.StandardPageSizeRect);
            int s1_id = s1.ID;

            // format it with setformulas
            var fg_cell  = s1.Cells["FillForegnd"];
            var bg_cell  = s1.Cells["FillBkgnd"];
            var pat_cell = s1.Cells["FillPattern"];

            fg_cell.FormulaU  = "RGB(255,0,0)";
            bg_cell.FormulaU  = "RGB(0,0,255)";
            pat_cell.FormulaU = "40";

            // now retrieve the formulas with GetFormulas

            var src_fg     = VA.ShapeSheet.SRCConstants.FillForegnd;
            var src_bg     = VA.ShapeSheet.SRCConstants.FillBkgnd;
            var src_filpat = VA.ShapeSheet.SRCConstants.FillPattern;

            var query         = new VA.ShapeSheet.Query.CellQuery();
            var col_fg        = query.Columns.Add(src_fg, "Foreground");
            var col_bg        = query.Columns.Add(src_bg, "Background");
            var col_filpat    = query.Columns.Add(src_filpat, "FillPattern");
            var sec_char      = query.Sections.Add(IVisio.VisSectionIndices.visSectionCharacter);
            var col_charcase  = sec_char.Columns.Add(VA.ShapeSheet.SRCConstants.CharCase, "Case");
            var col_charcolor = sec_char.Columns.Add(VA.ShapeSheet.SRCConstants.CharColor, "Color");
            var col_chartrans = sec_char.Columns.Add(VA.ShapeSheet.SRCConstants.CharColorTrans, "ColorTrans");

            var shapeids = new[] { s1_id };

            var formulas = query.GetFormulas(page1, shapeids);

            // now verify that the formulas were actually set
            Assert.AreEqual("RGB(255,0,0)", formulas[0][col_fg.Ordinal]);
            Assert.AreEqual("RGB(0,0,255)", formulas[0][col_bg.Ordinal]);
            Assert.AreEqual("40", formulas[0][col_filpat.Ordinal]);

            // now retrieve the results with GetResults as floats
            var float_results = query.GetResults <double>(page1, shapeids);

            Assert.IsNotNull(float_results);
            Assert.AreEqual(40.0, float_results[0][col_filpat.Ordinal]);

            // now retrieve the results with GetResults as ints
            var int_results = query.GetResults <int>(page1, shapeids);

            Assert.AreEqual(40, int_results[0][col_filpat.Ordinal]);

            // now retrieve the results with GetResults as strings

            var string_results = query.GetResults <string>(page1, shapeids);

            Assert.AreEqual("RGB(255, 0, 0)", string_results[0][col_fg.Ordinal]);
            Assert.AreEqual("RGB(0, 0, 255)", string_results[0][col_bg.Ordinal]);
            Assert.AreEqual("40", string_results[0][col_filpat.Ordinal]);

            page1.Delete(0);
            doc1.Close(true);
        }
        public void ShapeSheet_Update_ResultsDouble_MultipleShapes()
        {
            var page1 = GetNewPage();

            var shape1 = page1.DrawRectangle(-1, -1, 0, 0);
            var shape2 = page1.DrawRectangle(-1, -1, 0, 0);
            var shape3 = page1.DrawRectangle(-1, -1, 0, 0);

            // Set the formulas
            var update = new VA.ShapeSheet.Update();
            update.SetResult(shape1.ID16, src_pinx, 0.5, IVisio.VisUnitCodes.visNumber);
            update.SetResult(shape1.ID16, src_piny, 0.5, IVisio.VisUnitCodes.visNumber);
            update.SetResult(shape2.ID16, src_pinx, 1.5, IVisio.VisUnitCodes.visNumber);
            update.SetResult(shape2.ID16, src_piny, 1.5, IVisio.VisUnitCodes.visNumber);
            update.SetResult(shape3.ID16, src_pinx, 2.5, IVisio.VisUnitCodes.visNumber);
            update.SetResult(shape3.ID16, src_piny, 2.5, IVisio.VisUnitCodes.visNumber);
            update.Execute(page1);

            // Verify that the formulas were set
            var query = new VA.ShapeSheet.Query.CellQuery();
            var col_pinx = query.Columns.Add(src_pinx,"PinX");
            var col_piny = query.Columns.Add(src_piny,"PinY");

            var shapeids = new[] { shape1.ID, shape2.ID, shape3.ID };

            var rf = query.GetFormulas(page1, shapeids);
            var rr = query.GetResults<double>(page1, shapeids);

            AssertVA.AreEqual("0.5 in", 0.5, rf[0][col_pinx.Ordinal], rr[0][col_pinx.Ordinal]);
            AssertVA.AreEqual("0.5 in", 0.5, rf[0][col_piny.Ordinal], rr[0][col_piny.Ordinal]);
            AssertVA.AreEqual("1.5 in", 1.5, rf[1][col_pinx.Ordinal], rr[1][col_pinx.Ordinal]);
            AssertVA.AreEqual("1.5 in", 1.5, rf[1][col_piny.Ordinal], rr[1][col_piny.Ordinal]);
            AssertVA.AreEqual("2.5 in", 2.5, rf[2][col_pinx.Ordinal], rr[2][col_pinx.Ordinal]);
            AssertVA.AreEqual("2.5 in", 2.5, rf[2][col_piny.Ordinal], rr[2][col_piny.Ordinal]);

            page1.Delete(0);
        }
        public void ShapeSheet_Query_GetResults_MultipleShapes()
        {
            var page1 = this.GetNewPage();

            // draw a simple shape
            var s1 = page1.DrawRectangle(this.StandardPageSizeRect);
            int s1_id = s1.ID;

            // format it with setformulas
            var fg_cell = s1.Cells["FillForegnd"];
            var bg_cell = s1.Cells["FillBkgnd"];
            var pat_cell = s1.Cells["FillPattern"];

            fg_cell.ResultIU = 2.0; //red
            bg_cell.ResultIU = 3.0; //green
            pat_cell.ResultIU = 40.0;

            var src_fg = VA.ShapeSheet.SRCConstants.FillForegnd;
            var src_bg = VA.ShapeSheet.SRCConstants.FillBkgnd;
            var src_filpat = VA.ShapeSheet.SRCConstants.FillPattern;

            // now retrieve the formulas with GetFormulas

            var query = new VA.ShapeSheet.Query.CellQuery();
            var col_fg = query.AddCell(src_fg, "FillForegnd");
            var col_bg = query.AddCell(src_bg, "FillBkgnd");
            var col_filpat = query.AddCell(src_filpat, "FillPattern");

            var shapeids = new[] {s1_id};

            var formulas = query.GetFormulas(page1, shapeids);

            // now verify that the formulas were actually set
            Assert.AreEqual("2", formulas[0][col_fg]);
            Assert.AreEqual("3", formulas[0][col_bg]);
            Assert.AreEqual("40", formulas[0][col_filpat]);

            // now retrieve the results with GetResults as floats

            var float_results = query.GetResults<double>(page1,shapeids);
            Assert.AreEqual(2.0, float_results[0][col_fg]);
            Assert.AreEqual(3.0, float_results[0][col_bg]);
            Assert.AreEqual(40.0, float_results[0][col_filpat]);

            // now retrieve the results with GetResults as ints
            var int_results = query.GetResults<int>(page1,shapeids);

            Assert.AreEqual(2, int_results[0][col_fg]);
            Assert.AreEqual(3, int_results[0][col_bg]);
            Assert.AreEqual(40, int_results[0][col_filpat]);

            // now retrieve the results with GetResults as strings
            var string_results = query.GetResults<string>(page1,shapeids);
            Assert.AreEqual("2", string_results[0][col_fg]);
            Assert.AreEqual("3", string_results[0][col_bg]);
            Assert.AreEqual("40", string_results[0][col_filpat]);

            page1.Delete(0);
        }
        public void ShapeSheet_Query_GetResults_SingleShape()
        {
            var doc1 = this.GetNewDoc();
            var page1 = doc1.Pages[1];
            VisioAutomationTest.SetPageSize(page1, this.StandardPageSize);

            // draw a simple shape
            var s1 = page1.DrawRectangle(this.StandardPageSizeRect);
            int s1_id = s1.ID;

            // format it with setformulas
            var fg_cell = s1.Cells["FillForegnd"];
            var bg_cell = s1.Cells["FillBkgnd"];
            var pat_cell = s1.Cells["FillPattern"];

            fg_cell.FormulaU = "RGB(255,0,0)";
            bg_cell.FormulaU = "RGB(0,0,255)";
            pat_cell.FormulaU = "40";

            // now retrieve the formulas with GetFormulas

            var src_fg = VA.ShapeSheet.SRCConstants.FillForegnd;
            var src_bg = VA.ShapeSheet.SRCConstants.FillBkgnd;
            var src_filpat = VA.ShapeSheet.SRCConstants.FillPattern;

            var query = new VA.ShapeSheet.Query.CellQuery();
            var col_fg = query.AddCell(src_fg, "FillForegnd");
            var col_bg = query.AddCell(src_bg, "FillBkgnd");
            var col_filpat = query.AddCell(src_filpat, "FillPattern");
            var sec_char = query.AddSection(IVisio.VisSectionIndices.visSectionCharacter);
            Assert.AreEqual("Character",sec_char.Name);
            var col_charcase = sec_char.AddCell(VA.ShapeSheet.SRCConstants.CharCase, "CharCase");
            var col_charcolor = sec_char.AddCell(VA.ShapeSheet.SRCConstants.CharColor, "CharColor");
            var col_chartrans = sec_char.AddCell(VA.ShapeSheet.SRCConstants.CharColorTrans, "CharColorTrans");

            var shapeids = new[] {s1_id};

            var formulas = query.GetFormulas(page1, shapeids);

            // now verify that the formulas were actually set
            Assert.AreEqual("RGB(255,0,0)", formulas[0][col_fg]);
            Assert.AreEqual("RGB(0,0,255)", formulas[0][col_bg]);
            Assert.AreEqual("40", formulas[0][col_filpat]);

            // now retrieve the results with GetResults as floats
            var float_results = query.GetResults<double>(page1,shapeids);
            Assert.IsNotNull(float_results);
            Assert.AreEqual(40.0, float_results[0][col_filpat]);

            // now retrieve the results with GetResults as ints
            var int_results = query.GetResults<int>(page1,shapeids);
            Assert.AreEqual(40, int_results[0][col_filpat]);

            // now retrieve the results with GetResults as strings

            var string_results = query.GetResults<string>(page1,shapeids);

            Assert.AreEqual("RGB(255, 0, 0)", string_results[0][col_fg]);
            Assert.AreEqual("RGB(0, 0, 255)", string_results[0][col_bg]);
            Assert.AreEqual("40", string_results[0][col_filpat]);

            page1.Delete(0);
            doc1.Close(true);
        }
        public void ShapeSheet_Query_Demo_MultipleShapes()
        {
            var page1 = GetNewPage(new VA.Drawing.Size(10, 10));

            // draw a simple shape
            var s1 = page1.DrawRectangle(0, 0, 2, 2);
            var s2 = page1.DrawRectangle(4, 4, 6, 6);
            var s3 = page1.DrawRectangle(5, 5, 7, 7);

            var shapeids = new List<int> { s1.ID, s2.ID, s3.ID };

            Assert.AreEqual(3, page1.Shapes.Count);

            var query = new VA.ShapeSheet.Query.CellQuery();
            var col_pinx = query.Columns.Add(VA.ShapeSheet.SRCConstants.PinX,"PinX");
            var col_piny = query.Columns.Add(VA.ShapeSheet.SRCConstants.PinY,"PinY");

            var rf = query.GetFormulas(page1, shapeids);
            var rr = query.GetResults<double>(page1, shapeids);

            var expected_formulas = new[,]
                                      {
                                          {"1 in", "1 in"},
                                          {"5 in", "5 in"},
                                          {"6 in", "6 in"}
                                      };

            var expected_results = new[,]
                                      {
                                          {1.0, 1.0},
                                          {5.0, 5.0},
                                          {6.0, 6.0}
                                      };

            for (int row = 0; row < rr.Count; row++)
            {
                for (int col = 0; col < query.Columns.Count; col++)
                {
                    Assert.AreEqual(expected_formulas[row,col], rf[row][col]);
                    Assert.AreEqual(expected_results[row,col], rr[row][col]);
                }
            }

            page1.Delete(0);
        }