// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java // Create workbook from sample file Workbook workbook = new Workbook(); // Access first worksheet from the collection Worksheet sheet = workbook.getWorksheets().get(0); // Add the line to the worksheet sheet.getShapes().addShape(MsoDrawingType.LINE, 2, 0, 2, 0, 100, 300);//method 1 //sheet.getShapes().addAutoShape(AutoShapeType.LINE, 2, 0, 2, 0, 100, 300);//method 2 //Save.You can check your icon in this way. workbook.save("sample2.xlsx", SaveFormat.XLSX);