I am working on a program that requires writing results to a .docx
in a table format. I need to write images from a folder in some of the table cells, which I have been unable to figure out how to do. The solutions I have seen are to insert the image in the document.
Student student = new Student ();
XWPFDocument Document = new XWPFDocument ();
XWPFTable table = document.createTable(20,2);
XWPFTableRow rows =null;
XWPFTableCell cell = null;
for (int i=0; i<20; i++) {
rows = table.getRow(i)
student = studentList.get(i);
//first column
cell = rows.getCell(0);
//add image to this cell. The path to the image can be gotten from student.getImagePath and the image itself in BufferedImage can be gotten from student.getImage
//second column
cell = rows.getCell(1);
cell.setText(student.getDetails);
}