// Create a new workbook Workbook workbook = new Workbook(); IWorksheet worksheet = workbook.getWorksheets().get(0); IShapes shapes = worksheet.getShapes(); IShape pentagon = shapes.addShape(AutoShapeType.RegularPentagon, 89.4, 57.0, 153.6, 90.6); IShape pie = shapes.addShape(AutoShapeType.Pie, 344.4, 156.8, 50.4, 60.0); IShapeRange shpRange = shapes.getRange(new String[] { pentagon.getName(), pie.getName() }); // Group the shape range IShape grouped = shpRange.group(); grouped.getLine().setVisible(true); grouped.getLine().getColor().setRGB(Color.GetOrange()); // Save to an excel file workbook.save("ShapeGroup.xlsx");