@zhengkai,
Thanks for the template file and sample code.
I evaluated your scenario/ case a bit by using your template file and sample code. It is not an issue with the product and it works fine and as expected. Actually there are a few hidden sheets (e.g “初二” and “初四”) in your template file and when you use the line of code:
i.e.,
Worksheet worksheet = wc.get(0);
it will get the sheet “初二” at zero indexed position.
For your requirements, you should get the sheet by its name and not by its index, see the updated code segment which works fine as I tested:
e.g
Sample code:
Workbook workbook = new Workbook("f:\\files\\1.xls");
WorksheetCollection wc = workbook.getWorksheets();
Worksheet worksheet = wc.get("数学");
Cells cells = worksheet.getCells();
int maxColumnNum = cells.getMaxColumn();
int maxDataColumnNum = cells.getMaxDataColumn();
System.out.println(maxColumnNum);
System.out.println(maxDataColumnNum);
Hope, this helps a bit.