91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

java導入導出,全部文件jar包,ajax提交form表單后返回提示數據,所有用到的文件,方法,數據,有利于學習,方便運用

資源截圖

代碼片段和文件信息

package?com.lucion.sdp.utils;

import?com.lkx.util.StringUtil;
import?org.apache.commons.lang3.StringUtils;
import?org.apache.poi.hssf.usermodel.HSSFCellstyle;
import?org.apache.poi.hssf.usermodel.HSSFRow;
import?org.apache.poi.hssf.usermodel.HSSFSheet;
import?org.apache.poi.hssf.usermodel.HSSFWorkbook;
import?org.springframework.beans.BeanUtils;

import?javax.servlet.http.HttpServletResponse;
import?java.io.FileNotFoundException;
import?java.io.IOException;
import?java.io.OutputStream;
import?java.lang.reflect.Method;
import?java.text.SimpleDateFormat;
import?java.util.*;

public?class?ChseExcelUtils?{
????public?static?void?exportExcelOutputStream(HttpServletResponse?response?String?keyValue?List?list?String?classPath?String...?fileName)?throws?Exception?{
????????Map?map?=?getMap(keyValue);
????????List?keyList?=?getList(keyValue);
????????Class?demo?=?null;
????????demo?=?Class.forName(classPath);
????????object?obj?=?demo.newInstance();
????????HSSFWorkbook?wb?=?new?HSSFWorkbook();
????????HSSFSheet?sheet?=?wb.createSheet(“sheet1“);
????????HSSFCellstyle?style?=?wb.createCellstyle();
????????style.setAlignment((short)2);
????????HSSFRow?rowHeader?=?sheet.createRow(0);
????????Map?attMap?=?new?HashMap();
????????int?index?=?0;

????????String?newFileName;
????????for(Iterator?i$?=?keyList.iterator();?i$.hasNext();?++index)?{
????????????newFileName?=?(String)i$.next();
????????????rowHeader.createCell(index).setCellValue(newFileName);
????????????attMap.put(Integer.toString(index)?((String)map.get(newFileName)).toString());
????????}

????????for(int?i?=?1;?i?????????????HSSFRow?row?=?sheet.createRow(i);

????????????for(int?j?=?0;?j?????????????????Class?attrType?=?BeanUtils.findPropertyType((String)attMap.get(Integer.toString(j))?new?Class[]{obj.getClass()});
????????????????object?value?=?getAttrVal(list.get(i)?(String)attMap.get(Integer.toString(j))?attrType);
????????????????if(value==null){
????????????????????value?=?““;
????????????????}
????????????????row.createCell(j).setCellValue(value.toString());
????????????????style.setAlignment((short)2);
????????????}
????????}

????????try?{
????????????SimpleDateFormat?df?=?new?SimpleDateFormat(“yyyyMMddHHmmss“);
????????????newFileName?=?fileName[0];
????????????if?(StringUtils.isEmpty(fileName[0]))?{
????????????????newFileName?=?df.format(new?Date());
????????????}

????????????OutputStream?outstream?=?response.getOutputStream();
????????????response.reset();
????????????response.setHeader(“Content-disposition“?“attachment;?filename=“?+?new?String(newFileName.getBytes()?“iso-8859-1“)?+?“.xls“);
????????????//response.setContentType(“application/x-download“);
????????????response.setContentType(“application/octet-stream“);
????????????wb.write(outstream);
????????????outstream.close();
????????}?catch?(FileNotFoundExcept

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-04-16?11:24??excel導出導出\
?????文件????????4596??2019-04-15?15:55??excel導出導出\ChseExcelUtils.java
?????文件????????1855??2019-04-10?13:55??excel導出導出\ExcelSafetyOfficerDemo.java
?????文件???????11426??2019-04-16?11:14??excel導出導出\ExportDownload.java
?????文件???????29184??2019-04-16?11:16??excel導出導出\maven.doc
?????文件???????10606??2019-04-12?15:58??excel導出導出\導入moban.xlsx
?????文件????????1126??2019-04-16?11:23??excel導出導出\頁面和js.txt

評論

共有 條評論