JAVA中使用JXL操作EXCEL

Workbook rwb = null;
WorkbookSettings workbookSettings = new WorkbookSettings();
workbookSettings.setEncoding("GB2312");

try {
rwb = Workbook.getWorkbook(is, workbookSettings);
} catch (IOException e) {
e.printStackTrace();
} catch (BiffException e) {
e.printStackTrace();
}

log.info("开始导入数据.....");
String inputTypeDimension = param.get("inputTypeDimension").toString();
processXslFileMonth2(rwb,param);




Sheet rs[] = rwb.getSheets();
if (rs == null && rs.length == 0)
throw new AppException("数据为空!!");

try {
for (int shc = 0; shc < rs.length; shc++) {
outputcount_part = outputcount_part + getRightRows(rs[shc]);

if (getRightRows(rs[shc]) > 0) {
outputcount_part = outputcount_part - 2;
}

log.info("Sheet" + shc + "中有:" + getRightRows(rs[shc]) + "行");
}

outputcount = outputcount_part;
log.info("表格中一供有" + outputcount + "行");

for (int sh = 0; sh < rs.length; sh++) {
sheet = rs[sh];

int rows = getRightRows(sheet);
cols = sheet.getColumns();

log.info("表格中一供有" + cols + "列");

String begin_date = param.get("begin_date").toString();
String end_date = param.get("end_date").toString();

Powered by Zoundry

原文地址:https://www.cnblogs.com/attilax/p/15200045.html