When copy a range from one sheet to a new added sheet, is that possible to copy the conditional formatting along with it?
The code and the file are attached.
<pre style=“font-family: “Source Code Pro”; font-size: 12pt;”>final String dataDir = “”;
final Workbook workbook = new Workbook(dataDir + “template.xlsx”);
final Range sourceRange = workbook.getWorksheets().getRangeByName(“TestTable”);
if (sourceRange != null) {
final Worksheet destSheet = workbook.getWorksheets().add(“sheet2”);
final Range destRange =
destSheet.getCells().createRange(0, 0, sourceRange.getRowCount(), sourceRange.getColumnCount());
destRange.copy(sourceRange);
workbook.save(dataDir + “template.xlsx”);
}