Search code examples
javaapache-poixls

Ordering of sheets in excel in apache poi


I want to rearrange the sheets being generated before writing it to an xls document using apache poi in java. Is there any way of doing it? For ex:sheet Names are "RF for 10","Blended for 10","RF for 30","Blended for 30".

I want the xls to be generated in the following order of sheets: "RF for 10","RF for 30","Blended for 10","Blended for 30".


Solution

  • You can rearrange the order of the sheets in a workbook with the setSheetOrder method of the Workbook class.