public static List<Synsetcn> read365Excel(String url) {
Synsetcn synsetcn = null;
List<Synsetcn> synsetcns = new ArrayList<Synsetcn>();
try {
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File(url)));
if (null != workbook.getSheetAt(0)) {
XSSFSheet sheet = workbook.getSheetAt(0);
int iRowNum = sheet.getLastRowNum();
for (int i = 1; i < iRowNum + 1; i++) {
if (null != sheet.getRow(i)) {
XSSFRow rows = sheet.getRow(i);
XSSFCell cell0 = rows.getCell(0);
if (null != rows.getCell(0) && null != rows.getCell(1)) {
synsetcn = new Synsetcn();
long id = 900000000 + i;
synsetcn.setSynset_id(id + "");
synsetcn.setChinese(cell0.getStringCellValue());
synsetcn.setW_num(1);
synsetcns.add(synsetcn);
}
if (null != rows.getCell(0) && null != rows.getCell(1)) {
XSSFCell cell1 = rows.getCell(1);
String str = cell1.getStringCellValue();
if (Util.getInstance().StringIsEmpty(str)) {
String[] strs = str.split("\\|");
int z = 1;
for (int j = 0; j < strs.length; j++) {
z = z + 1;
synsetcn = new Synsetcn();
long id = 900000000 + i;
synsetcn.setSynset_id(id + "");
synsetcn.setW_num(z);
synsetcn.setChinese(strs[j]);
if (Util.getInstance().StringIsEmpty(
strs[j])) {
synsetcns.add(synsetcn);
} else {
z = z - 1;
}
}
}
}
}
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return synsetcns;
}
Synsetcn synsetcn = null;
List<Synsetcn> synsetcns = new ArrayList<Synsetcn>();
try {
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File(url)));
if (null != workbook.getSheetAt(0)) {
XSSFSheet sheet = workbook.getSheetAt(0);
int iRowNum = sheet.getLastRowNum();
for (int i = 1; i < iRowNum + 1; i++) {
if (null != sheet.getRow(i)) {
XSSFRow rows = sheet.getRow(i);
XSSFCell cell0 = rows.getCell(0);
if (null != rows.getCell(0) && null != rows.getCell(1)) {
synsetcn = new Synsetcn();
long id = 900000000 + i;
synsetcn.setSynset_id(id + "");
synsetcn.setChinese(cell0.getStringCellValue());
synsetcn.setW_num(1);
synsetcns.add(synsetcn);
}
if (null != rows.getCell(0) && null != rows.getCell(1)) {
XSSFCell cell1 = rows.getCell(1);
String str = cell1.getStringCellValue();
if (Util.getInstance().StringIsEmpty(str)) {
String[] strs = str.split("\\|");
int z = 1;
for (int j = 0; j < strs.length; j++) {
z = z + 1;
synsetcn = new Synsetcn();
long id = 900000000 + i;
synsetcn.setSynset_id(id + "");
synsetcn.setW_num(z);
synsetcn.setChinese(strs[j]);
if (Util.getInstance().StringIsEmpty(
strs[j])) {
synsetcns.add(synsetcn);
} else {
z = z - 1;
}
}
}
}
}
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return synsetcns;
}