Hi,
Hi,
Hi again,
Worksheet sheet = workbook.getWorksheets().get(0);
Cells cells = sheet.getCells();
ListObject table = sheet.getListObjects().get(0);
Row row = cells.getRows().get(table.getEndRow());
StyleFlag flag = new StyleFlag();
flag.setNumberFormat(true);
Style style = row.get(1).getStyle();
style.setNumber(2);
row.get(1).setStyle(style, flag);
workbook.save(dir + “output.xlsx”);
Will the above code set precision to all the values in that column or just the last last row’s cell? I want to set the same precision to whole column.
Hi Hitesh,
Worksheet sheet = workbook.getWorksheets().get(0);
Cells cells = sheet.getCells();
ListObject table = sheet.getListObjects().get(0);
ListColumn column = table.getListColumns().get(1);
StyleFlag flag = new StyleFlag();
flag.setNumberFormat(true);
Style style = workbook.createStyle();
style.setNumber(2);
column.getRange().applyStyle(style, flag);
workbook.save(dir + “output.xlsx”);