2024年4月7日发(作者:)

enctype="multipart/form-data" method="post">

type="file" />

" onclick="downloadModalExcel();">点击下载模板

class="quickpro-button" onclick="submitExcel();"/>

/**

* 数据文件导入

*

* @param request

* @param response

* @throws IOException

* @throws FileNotFoundException

*/

@RequestMapping({ "importOCRExcelData" })

public void importOCRExcelData(HttpServletRequest

request,HttpServletResponse response) throws FileNotFoundException,

IOException

{

MultipartHttpServletRequest mulRequest =

(MultipartHttpServletRequest) request;

MultipartFile file = e("excelFile");

String filename = ginalFilename();

if (filename == null || "".equals(filename))

{

}

try

{

InputStream input = utStream();

XSSFWorkbook workBook = new XSSFWorkbook(input);

List sfList =

ListFromExcel(workBook, 0);

for(int i=0 ; i<();i++)

{

("【"+(i).toString()+"】 ");

}

}

catch (Exception e)

{

(e);

}

}

/**

* 由指定的Sheet导出至List

*

* @param workbook

* @param sheetNum

* @return

* @throws IOException

*/

public static List exportListFromExcel(Workbook workbook,

int sheetNum)

{

Sheet sheet = etAt(sheetNum);

// 解析公式结果

FormulaEvaluator evaluator = ationHelper()

.createFormulaEvaluator();

List list = new ArrayList();

int minRowIx = stRowNum();

int maxRowIx = tRowNum();

for (int rowIx = minRowIx; rowIx <= maxRowIx; rowIx++)

{

Row row = (rowIx);

StringBuilder sb = new StringBuilder();

short minColIx = stCellNum();

short maxColIx = tCellNum();

for (short colIx = minColIx; colIx <= maxColIx; colIx++)

{

Cell cell = l(new Integer(colIx));