Ejemplo n.º 1
0
        Shapes.ShapeDefine.MsoShapeType GetShapeType(int idx)
        {
            Shapes.ShapeDefine.MsoShapeType t = Shapes.ShapeDefine.MsoShapeType.msoShapeRectangle;
            switch (idx)
            {
            case 0: return(Shapes.ShapeDefine.MsoShapeType.msoShapeLineCallout1);

            case 1: return(Shapes.ShapeDefine.MsoShapeType.msoShapeRectangle);

            case 2: return(Shapes.ShapeDefine.MsoShapeType.msoShapeRightArrow);

            case 3: return(Shapes.ShapeDefine.MsoShapeType.msoShapeLeftArrow);

            case 4: return(Shapes.ShapeDefine.MsoShapeType.msoShapeLeftRightArrow);

            case 5: return(Shapes.ShapeDefine.MsoShapeType.msoShapeUpArrow);

            case 6: return(Shapes.ShapeDefine.MsoShapeType.msoShapeRightTriangle);

            case 7: return(Shapes.ShapeDefine.MsoShapeType.msoShapeOctagon);

            default: return(Shapes.ShapeDefine.MsoShapeType.msoShapeOval);
            }

            return(t);
        }
Ejemplo n.º 2
0
        private void btnAddShape_Click(object sender, EventArgs e)
        {
            ExcelBinder excelbinder = new ExcelBinder();

            excelbinder.NewDocument();

            excelbinder.Visible = true;

            excelbinder.SetActiveWorkSheet(1);

            Shapes.ShapeDefine.MsoShapeType stype = GetShapeType(cbShapeType.SelectedIndex);
            excelbinder.InsertShapes(stype, 100, 100, 150, 20);

            excelbinder.SaveDocument(Path.Combine(Environment.CurrentDirectory, "testshapes" + (int)stype + ".xlsx"));

            excelbinder.CloseDocument();

            excelbinder.QuitDocument();
        }