Example: copyTo method

This example copies the second sheet before the first sheet, and then displays the name of the copied sheet.

  Sheet sheet = sheets.item(1);
  Sheet copySheet = sheets.item(2);
  copySheet.copyTo(sheet, true);
  System.out.println(sheet.previous().getName());

Related information

copyTo method