// Create a new workbook Workbook workbook = new Workbook(); IWorksheet worksheet = workbook.getWorksheets().get(0); IShape shapeBegin = worksheet.getShapes().addShape(AutoShapeType.Rectangle, 1, 1, 100, 100); IShape shapeEnd = worksheet.getShapes().addShape(AutoShapeType.Rectangle, 200, 200, 100, 100); IShape ConnectorShape = worksheet.getShapes().addConnector(ConnectorType.Straight, 1, 1, 101, 101); //connect shapes by connector shape. ConnectorShape.getConnectorFormat().beginConnect(shapeBegin, 3); ConnectorShape.getConnectorFormat().endConnect(shapeEnd, 0); // Save to an excel file workbook.save("ConnectShapesByConnector.xlsx");