springMVC拦截器中如何获得被拦截方法的返回值
2016-12-14 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
去阿帕奇下载apache.org/poi
项目的源码:
import org.apache.poi.ss.usermodel.Row
import org.apache.poi.xssf.usermodel.XSSFCell
import org.apache.poi.xssf.usermodel.XSSFRow
import org.apache.poi.xssf.usermodel.XSSFSheet
import org.apache.poi.xssf.usermodel.XSSFWorkbook
/**
* Created by WangQing on 15/11/20.
*/
class TestGroovy {
void updateResourceDate(){
def filePath = "./assets/people.xlsx"
File file = new File(filePath)
FileInputStream is = new FileInputStream(file);
XSSFWorkbook workbook = new XSSFWorkbook(is);
workbook.setMissingCellPolicy(Row.CREATE_NULL_AS_BLANK);
//循环sheet
(0..<workbook.sheetIterator().collect {return it}.@size).each {s->
XSSFSheet sheet = workbook.getSheetAt(s);
int rows = sheet.physicalNumberOfRows;
//忽略第一行,标题行
(1..<rows).each{r->
XSSFRow row = sheet.getRow(r);
def cells = row.physicalNumberOfCells;
(0..<cells).each{c->
XSSFCell cell = row.getCell(c);
def name = "";
switch (c) {
case 0:
name = "A:"
break;
case 1:
name = "B:"
break
case 2:
name = "C:"
break
case 3:
name = "D:"
break
}
print name + " "+cell+ ", ";
}
println "";
}
}
}
static main(args) {
TestGroovy a = new TestGroovy();
a.updateResourceDate();
}
}
项目的源码:
import org.apache.poi.ss.usermodel.Row
import org.apache.poi.xssf.usermodel.XSSFCell
import org.apache.poi.xssf.usermodel.XSSFRow
import org.apache.poi.xssf.usermodel.XSSFSheet
import org.apache.poi.xssf.usermodel.XSSFWorkbook
/**
* Created by WangQing on 15/11/20.
*/
class TestGroovy {
void updateResourceDate(){
def filePath = "./assets/people.xlsx"
File file = new File(filePath)
FileInputStream is = new FileInputStream(file);
XSSFWorkbook workbook = new XSSFWorkbook(is);
workbook.setMissingCellPolicy(Row.CREATE_NULL_AS_BLANK);
//循环sheet
(0..<workbook.sheetIterator().collect {return it}.@size).each {s->
XSSFSheet sheet = workbook.getSheetAt(s);
int rows = sheet.physicalNumberOfRows;
//忽略第一行,标题行
(1..<rows).each{r->
XSSFRow row = sheet.getRow(r);
def cells = row.physicalNumberOfCells;
(0..<cells).each{c->
XSSFCell cell = row.getCell(c);
def name = "";
switch (c) {
case 0:
name = "A:"
break;
case 1:
name = "B:"
break
case 2:
name = "C:"
break
case 3:
name = "D:"
break
}
print name + " "+cell+ ", ";
}
println "";
}
}
}
static main(args) {
TestGroovy a = new TestGroovy();
a.updateResourceDate();
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询