Copy a range from one sheet to a new sheet- the conditional formatting is gone

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”);
}

Hi,


Thanks for your posting and using Aspose.Cells.

Please change the formula

=$D$4>10

to

=D4>10 i.e. (remove $ sign)

and it will work fine. Please see the screenshot for more help. Let us know your feedback.

That make sense. Thanks, Shakeel.