// Create a new workbook Workbook workbook = new Workbook(); // Configure the network request processor, which requires user customization. Workbook.setWebRequestHandler(new WebRequestHandler()); IWorksheet worksheet = workbook.getWorksheets().get(0); // Init data Object[][] data = new Object[][]{ {"SKU", "ITEM", "QTY", "COST"}, {"BO87680", "Boots", 30, 20}, {"DR676554", "Dress", 10, 50}, {"GL98767", "Glasses", 40, 15}, {"HA23423", "Hat", 12, 26}, {"JA87684", "Jacket", 10, 100}, {"SH67655", "Shorts", 19, 30}, {"SLG123", "Slippers", 25, 8}, {"SU98762", "Suitcase", 7, 50}, {"SW3456", "Swimsuit", 15, 60}, {"TS98768", "T-shirt", 20, 14} }; worksheet.getRange("A1:D11").setValue(data); worksheet.getRange("E1").setValue("IMAGE"); // Setting the image function worksheet.getRange("E2").setFormula("= IMAGE(\"https://cdn-icons-png.flaticon.com/512/1785/1785348.png\")"); worksheet.getRange("E3").setFormula("= IMAGE(\"https://cdn-icons-png.flaticon.com/512/2682/2682178.png\")"); worksheet.getRange("E4").setFormula("= IMAGE(\"https://cdn-icons-png.flaticon.com/512/1971/1971886.png\")"); worksheet.getRange("E5").setFormula("= IMAGE(\"https://cdn-icons-png.flaticon.com/512/1357/1357590.png\")"); worksheet.getRange("E6").setFormula("= IMAGE(\"https://cdn-icons-png.flaticon.com/512/2411/2411728.png\")"); worksheet.getRange("E7").setFormula("= IMAGE(\"https://cdn-icons-png.flaticon.com/512/5029/5029595.png\")"); worksheet.getRange("E8").setFormula("= IMAGE(\"https://cdn-icons-png.flaticon.com/512/15618/15618724.png\")"); worksheet.getRange("E9").setFormula("= IMAGE(\"https://cdn-icons-png.flaticon.com/512/3412/3412695.png\")"); worksheet.getRange("E10").setFormula("= IMAGE(\"https://cdn-icons-png.flaticon.com/512/5398/5398550.png\")"); worksheet.getRange("E11").setFormula("= IMAGE(\"https://cdn-icons-png.flaticon.com/512/1867/1867565.png\")"); // Setting the style worksheet.getRange("2:11").setRowHeightInPixel(75); IRange range = worksheet.getRange("A1:E11"); ITable table = worksheet.getTables().add(range, true); table.setTableStyle(workbook.getTableStyles().get("TableStyleMedium2")); range.getBorders().get(BordersIndex.InsideHorizontal).setLineStyle(com.grapecity.documents.excel.BorderLineStyle.Thin); range.getBorders().get(BordersIndex.InsideVertical).setLineStyle(com.grapecity.documents.excel.BorderLineStyle.Thin); range.getBorders().get(BordersIndex.EdgeTop).setLineStyle(com.grapecity.documents.excel.BorderLineStyle.Thin); range.getBorders().get(BordersIndex.EdgeLeft).setLineStyle(com.grapecity.documents.excel.BorderLineStyle.Thin); range.getBorders().get(BordersIndex.EdgeRight).setLineStyle(com.grapecity.documents.excel.BorderLineStyle.Thin); range.getBorders().get(BordersIndex.EdgeRight).setLineStyle(com.grapecity.documents.excel.BorderLineStyle.Thin); // Calculate all formulas so the asynchronous image function will run. workbook.calculate(); // Block the current thread until all asynchronous functions have finished. // If this method is not called, the exported file may contain #BUSY! error. workbook.waitForCalculationToFinish(); // Save to an excel file workbook.save("ImageFunction.xlsx");