国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
poi批量實(shí)現(xiàn)導(dǎo)入功能,jxl實(shí)現(xiàn)導(dǎo)入預(yù)覽功能
  1. ////////////總結(jié):  
  2.         導(dǎo)入流程:先下載導(dǎo)入模板,根據(jù)導(dǎo)入模板填寫(xiě)內(nèi)容,填寫(xiě)完保存到本地,  
  3.         點(diǎn)擊批量數(shù)據(jù)導(dǎo)入彈出導(dǎo)入文件選擇界面,點(diǎn)擊預(yù)覽數(shù)據(jù)彈出表格,  
  4.         點(diǎn)擊導(dǎo)入數(shù)據(jù),開(kāi)始導(dǎo)入。  
  5.         其中技術(shù)點(diǎn)有:io實(shí)現(xiàn)下載,poi實(shí)現(xiàn)導(dǎo)入,jxl實(shí)現(xiàn)導(dǎo)入預(yù)覽。  
  6.         需要的jar:  
  7.         poi-3.14-20160307.jar  
  8.         poi-extend4.0-20150421.jar  
  9.         jxl.jar  
  10.         commons-fileupload-1.3.1.jar  
  11.         commons-io-2.4.jar  
  12. <a href="javascript:void(0)" class="easyui-linkbutton" id="docpath" iconCls="icon-excel" plain="true" onclick="DownLoad()">批量數(shù)據(jù)導(dǎo)入模版</a>  
  13.         
  14. 點(diǎn)擊批量數(shù)據(jù)導(dǎo)入模版的時(shí)候執(zhí)行  
  15. function DownLoad(){  
  16.         $('#fpForm').submit();  
  17. }  
  18.   
  19. //這個(gè)是對(duì)應(yīng)的下載導(dǎo)入模板  
  20. <div id="fpForm1" style="float:left;margin-left:25px;">  
  21.     <form id="fpForm" action="${request.contextPath}/TdLawTask/download"  method="post"><!--action對(duì)應(yīng)的是controle路徑-->  
  22.         <label style="width:60px"></label><input id="fp" name="filepath" value="WEB-INF/upload/files/import/單位導(dǎo)入數(shù)據(jù)模板.xls" type="hidden"  /><!--value是模板路徑值-->  
  23.     </form>  
  24. </div>  
  25.   
  26. 提交到后臺(tái)controle的路徑(action="${request.contextPath}/TdLawTask/download")  
  27. /** 
  28.  * @Description下載選中行的附件 
  29.  */  
  30. @ResponseBody  
  31. @RequestMapping("download")  
  32. public void download(@RequestParam String filepath,  
  33.         HttpServletRequest request, HttpServletResponse response) {  
  34.     filepath = filepath.replace("/", "\\");  
  35.     FileUtil.downloadfile(filepath, request, response);  
  36. }  
  37.       
  38. 下載工具類(lèi)FileUtil  
  39. /** 
  40.  * 下載文件(不需要修改,直接使用) 
  41.  *  
  42.  * @param file 
  43.  * @param request 
  44.  * @param isPic 
  45.  * @return 
  46.  */  
  47. public static String downloadfile(String filepath,  
  48.         HttpServletRequest request, HttpServletResponse response) {  
  49.     String filename = "";  
  50.     //windows 中和liunx中路徑格式不一致  
  51.     if (File.separator.equals("\\")) {  
  52.         filepath = filepath.replace("/", "\\");  
  53.         filename = filepath.substring(filepath.lastIndexOf("\\") + 1);  
  54.     } else {  
  55.         filepath = filepath.replace("\\", "/");  
  56.         filename = filepath.substring(filepath.lastIndexOf("/") + 1);  
  57.     }  
  58.     //設(shè)置響應(yīng)編碼格式  
  59.     response.setCharacterEncoding("utf-8");  
  60.     //設(shè)置文件ContentType類(lèi)型,這樣設(shè)置,會(huì)自動(dòng)判斷下載文件類(lèi)型   
  61.     response.setContentType("multipart/form-data");  
  62.     // response.setHeader("Content-Disposition", "attachment;fileName="  
  63.     // + filename);  
  64.     String path = "";  
  65.     try {  
  66.         //設(shè)置文件頭:最后一個(gè)參數(shù)是設(shè)置下載文件名  
  67.         response.addHeader("Content-Disposition", "attachment;filename="  
  68.                 + new String(filename.getBytes("gbk"), "iso-8859-1")); // 轉(zhuǎn)碼之后下載的文件不會(huì)出現(xiàn)中文亂碼  
  69.         //獲取Web項(xiàng)目的全路徑   
  70.         path = request.getSession().getServletContext().getRealPath("/")  
  71.                 + filepath;  
  72.         File file = new File(path);  
  73.         if (!file.exists())  
  74.             return path;  
  75.         // System.out.println(path);  
  76.         response.addHeader("Content-Length", "" + file.length());  
  77.         InputStream inputStream = new FileInputStream(file);  
  78.         OutputStream os = response.getOutputStream();  
  79.         byte[] b = new byte[2048];  
  80.         int length;  
  81.         while ((length = inputStream.read(b)) > 0) {  
  82.             os.write(b, 0, length);  
  83.         }  
  84.         os.close();  
  85.         inputStream.close();  
  86.     } catch (FileNotFoundException e) {  
  87.         e.printStackTrace();  
  88.     } catch (IOException e) {  
  89.         e.printStackTrace();  
  90.     }  
  91.     return path;  
  92. }  
  93.   
  94.   
  95. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-excel" plain="true" onclick="implexll();">批量數(shù)據(jù)導(dǎo)入</a>  
  96.   
  97. //點(diǎn)擊批量數(shù)據(jù)導(dǎo)入時(shí),打開(kāi)批量導(dǎo)入數(shù)據(jù)表單  
  98. function implexll(){  
  99.     $('#dlgup').dialog('open').dialog('setTitle','導(dǎo)入excel');  
  100.     $('#impsearchfm').form('clear');   
  101. }  
  102.   
  103. <!--批量導(dǎo)入數(shù)據(jù)表單-->  
  104. <div id="dlgup" class="easyui-dialog"  style="padding:10px 20px;" closed="true" buttons="#dlg-buttons-up">  
  105.     <form id="impsearchfm"  novalidate  method="post"  enctype="multipart/form-data" style="float:left">  
  106.             <div class="fitem">     
  107.                 <label style="width:90px">文件路徑:</label>  
  108.                 <input  name="file" id="file" class="easyui-filebox" style="width:240px" data-options="buttonText:'選擇文件',buttonIcon:'icon-search',prompt:'文件路徑...'" value="選擇文件">  
  109.             </div>  
  110.     </form>  
  111. </div>  
  112. <div id="dlg-buttons-up">  
  113.     <a href="javascript:void(0)" onclick="preview();" class="easyui-linkbutton" iconCls="icon-search">預(yù)覽數(shù)據(jù)</a>  
  114.     <a href="javascript:void(0)" onclick="implexl();" class="easyui-linkbutton" iconCls="icon-excel">導(dǎo)入數(shù)據(jù)</a>  
  115. </div>  
  116.   
  117. <!--導(dǎo)入時(shí)預(yù)覽表單-->  
  118. <div id="ppreview" class="easyui-dialog" closed="true" buttons="#dlg-buttons-up-ppreview" style="width:800px;height:500px;"  >  
  119. <table id="dgpreview"  class="easyui-datagrid"  style="width:auto;height:100%;overflow:hidden;"  
  120.        striped="true" fit="true" fitColumns="true"  scrollbarSize=0  
  121.         pagination="false"  rownumbers="true" singleSelect="true"  
  122.        data-options="fit:true,border:false,pagesize:2000,pageList:[20000]"  >     
  123.   <thead>  
  124.     <tr>  
  125.         <th data-options="field:'userId',align:'left',halign:'center',width:'12%'">測(cè)試</th>  
  126.         <th data-options="field:'corpname',align:'left',halign:'center',width:'36%'" formatter=namecolor>測(cè)試1</th>  
  127.     </tr>  
  128.   </thead>  
  129. </table>  
  130. </div>  
  131. <div id="dlg-buttons-up-ppreview">  
  132.     <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#ppreview').dialog('close')" style="width:90px">取消</a>  
  133. </div>      
  134.   
  135. //點(diǎn)擊預(yù)覽數(shù)據(jù)  
  136. function preview(){  
  137.     $('#ppreview').dialog('open').dialog('setTitle','信息預(yù)覽');  
  138.       
  139.     var filename=$('#file').filebox('getValue');  
  140.             if(filename==null || filename=='')  
  141.             {  
  142.                 showMsg('提示','請(qǐng)選擇文件!');  
  143.                 return;  
  144.             }  
  145.     $('#impsearchfm').form('submit',{  
  146.             url: '${request.contextPath}/business/getfilename',//請(qǐng)求后臺(tái)  
  147.             onSubmit: function(){  
  148.             $.messager.progress({  
  149.                 title : '提示',  
  150.                 text : '數(shù)據(jù)處理中,請(qǐng)稍后....'  
  151.                });  
  152.                return true;  
  153.             },  
  154.             success: function(data){  
  155.               
  156.             //上傳文件并得到文件名  
  157.             loadPriview(data);  
  158.             }  
  159.     });  
  160.       
  161.     function loadPriview(filename){  
  162.         $.ajax({  
  163.             type : 'get',  
  164.             url : '${request.contextPath}/business/preview',  
  165.             dataType : 'json',  
  166.             data : {data :filename},  
  167.             cache :false,  
  168.             success : function(data) {  
  169.                 $.messager.progress('close');  
  170.                 $('#dgpreview').datagrid({     
  171.                     data:data  
  172.                 });              
  173.             }  
  174.         });  
  175.     }     
  176. }  
  177. //${request.contextPath}/business/getfilename',//后臺(tái)代碼  
  178. /** 
  179.  *  
  180.  * @Method_Name: getfilename 
  181.  * @Description: 上傳文件并返回文件名 
  182.  */  
  183. @ResponseBody  
  184. @RequestMapping("getfilename")  
  185. public String getFileName(DicInputPrd dicinputprd,@RequestParam("file") MultipartFile file, HttpServletRequest request,HttpSession session) {  
  186.     String filePath="";  
  187.     String fileName="";  
  188.       
  189.     if(file!=null){  
  190.         if(file.getSize()>0)  
  191.             filePath=FileUtil.upload(file, request, true);//調(diào)用下面的上傳文件  
  192.         fileName=request.getSession().getServletContext()  
  193.                 .getRealPath("/")+filePath;  
  194.     }  
  195.     return fileName;  
  196. }  
  197.   
  198. 上傳下載工具類(lèi)FileUtil  
  199. /** 
  200.  * 上傳文件 
  201.  *  
  202.  * @param file 
  203.  * @param request 
  204.  * @param isPic 
  205.  * @return 
  206.  */  
  207. public static String upload(MultipartFile file, HttpServletRequest request,  
  208.         Boolean isPic) {  
  209.     SimpleDateFormat dateformat = new SimpleDateFormat("yyyy_MM_dd/HHMMSS");  
  210.     //文件夾名字  
  211.     String pathDir = "upload" + File.separator + "imgs" + File.separator  
  212.             + dateformat.format(new Date()) + (int) Math.random() * 1000  
  213.             + File.separator;  
  214.     if (File.separator.equals("\\")) {  
  215.         pathDir = pathDir.replace("/", "\\");  
  216.     }  
  217.   
  218.     if (isPic == false) {  
  219.         pathDir = pathDir.replace("imgs", "files");  
  220.     }  
  221.   
  222.     String filename = file.getOriginalFilename();//獲取文件名  
  223.     String extName = "";  
  224.     if (StrUtil.isNotBlank(filename)) {//判斷是否為空,不為空走if  
  225.         int t = filename.lastIndexOf(".");  
  226.         if (t > 0) {  
  227.             extName = filename.substring(t).toLowerCase();//獲取文件的后綴名字  
  228.         }  
  229.     }  
  230.     filename = sdf.format(new Date());//時(shí)間格式化  
  231.     // File file2 = new File(request.getSession().getServletContext()  
  232.     // .getRealPath(pathDir));  
  233.     pathDir += filename + extName;//上傳的路徑完整名  
  234.     String realPathDir = request.getSession().getServletContext()  
  235.             .getRealPath(pathDir);//項(xiàng)目的完整路徑名  
  236.     // if(!file2.exists())  
  237.     // file2.mkdir();  
  238.     try {  
  239.         FileUtils.copyInputStreamToFile(file.getInputStream(), new File(  
  240.                 realPathDir));  
  241.     } catch (IOException e) {  
  242.         e.printStackTrace();  
  243.     }  
  244.     return pathDir;  
  245. }  
  246. ${request.contextPath}/business/preview',后臺(tái)代碼,獲取excel表格中數(shù)據(jù),并按照指定格式返回  
  247.   
  248. //導(dǎo)入時(shí)預(yù)覽  
  249. @ResponseBody  
  250. @RequestMapping("preview")  
  251. public JqueryUiJson preview(String data, HttpServletRequest request,HttpSession session) {    
  252.     List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();  
  253.     try {  
  254.             InputStream is = new FileInputStream(data);      
  255.             jxl.Workbook rwb = Workbook.getWorkbook(is);//得到工作薄  
  256.             Sheet[] rslist=rwb.getSheets();//工作?。╓orkbook)中工作表(Sheet)對(duì)象數(shù)組   
  257.             //循環(huán)讀取sheet工作表  
  258.             for(int i=0;i<rslist.length;i++){  
  259.                 //獲取Sheet表中所包含的總行數(shù):getRows()  
  260.                 for(int j=1;j<rslist[i].getRows();j++){  
  261.                     Map<String, Object> map = new HashMap<String,Object>();  
  262.                     int length = rslist[i].getColumns();//獲取Sheet表中所包含的總列數(shù):getColumns()  
  263.                     String[] content=new String[length];//內(nèi)容數(shù)組content  
  264.                     //如果一行沒(méi)有任何內(nèi)容,則跳過(guò)  
  265.                     int flag = 0;  
  266.                     for( int t=0;t<length;t++){//取到某行某列的內(nèi)容  
  267.                         content[t]=rslist[i].getCell(t,j).getContents().trim();  
  268.                         if(!"".equals(content[t])&&content[t] != null){  
  269.                             flag=1;  
  270.                         }  
  271.                     }  
  272.                     if(flag==0){  
  273.                         continue;  
  274.                     }  
  275.                     map.clear();  
  276.                       
  277.                     //這里可以對(duì)某一列進(jìn)行處理(這里可以修改start)  
  278.                     String industry="";  
  279.                     String [] stringArr = content[7].split(";");  
  280.                     for(int t = 0;t<stringArr.length;t++){                         
  281.                         String sql6 = "SELECT VALUE as industry FROM sys_aaaa WHERE id = 'dic' AND item = '"+stringArr[t]+"'";  
  282.                         Map map6 = sqlMapper.selectOne(sql6,new Object[]{"industry"});  
  283.                         if(map6!=null){  
  284.                             industry += map6.get("industry").toString()+",";  
  285.                         }  
  286.                     }  
  287.                     industry=industry.substring(0,industry.length()-1);  
  288.                    //這里可以對(duì)某一列進(jìn)行處理(這里可以修改end)  
  289.                     map.put("ceshi1", content[0]);  
  290.                     map.put("ceshi2", content[1]);  
  291.                     map.put("ceshi3", content[2]);  
  292.                     map.put("ceshi4", content[3]);  
  293.                     map.put("ceshi5", content[4]);  
  294.                     map.put("ceshi6", content[5]);  
  295.                     map.put("ceshi7", industry);  
  296.                     map.put("ceshi8", content[6]);  
  297.                     list.add(map);  
  298.                 }  
  299.             }     
  300.             rwb.close();//關(guān)閉工作薄  
  301.             //返回結(jié)果//返回(總條數(shù)(total),數(shù)據(jù)(rows))的格式。(這里根據(jù)自己需要的格式進(jìn)行返回)  
  302.             JqueryUiJson jqueryUiJson = new JqueryUiJson(ExampleUtil.getPageInfo(list).getTotal(), list);  
  303.             return jqueryUiJson;  
  304.         }catch(Exception e){  
  305.                 e.printStackTrace();  
  306.                 return null;  
  307.         }     
  308.     }  
  309.       
  310. 這個(gè)是分頁(yè)數(shù)據(jù)格式化,包名:(import com.github.pagehelper.PageInfo)     
  311. public static <T> PageInfo<T> getPageInfo(List<T> tlist) {  
  312.         PageInfo<T> pageinfo = new PageInfo<T>(tlist);  
  313.         return pageinfo;  
  314.     }  
  315.   
  316.   
  317. //點(diǎn)擊導(dǎo)入數(shù)據(jù)  
  318. function implexl(){  
  319.     var filename=$('#file').filebox('getValue');//獲取文件名  
  320.     if(filename==null || filename=='')  
  321.     {  
  322.         showMsg('提示','請(qǐng)選擇文件!');  
  323.         return;  
  324.     }  
  325.     $('#impsearchfm').form('submit',{  
  326.             url: '${request.contextPath}/business/importExl',  
  327.             onSubmit: function(){  
  328.             $.messager.progress({//提示信息  
  329.                 title : '提示',  
  330.                 text : '數(shù)據(jù)處理中,請(qǐng)稍后....'  
  331.                });  
  332.                return true;  
  333.             },  
  334.             success: function(result){  
  335.             $.messager.progress('close');//成功關(guān)閉提示信息  
  336.             var rtnMsg="";  
  337.                 if (result!="0"){  
  338.                     showMsg('錯(cuò)誤提示','上傳數(shù)據(jù)不規(guī)范');  
  339.                 } else {  
  340.                     showMsg('提示','數(shù)據(jù)導(dǎo)入成功');  
  341.                     //刷新列表   
  342.                     //關(guān)閉提示框  
  343.                 }  
  344.             }  
  345.         });  
  346. }   
  347.   
  348. //導(dǎo)入時(shí)請(qǐng)求后臺(tái)  
  349. '${request.contextPath}/business/importExl',請(qǐng)求對(duì)應(yīng)的后臺(tái)  
  350.   
  351. /** 
  352.  * @Method_Name: importExl 
  353.  * @Description: 批量導(dǎo)入 
  354.  */  
  355. @ResponseBody  
  356. @RequestMapping("importExl")  
  357. public String importExl(@RequestParam("file") MultipartFile file, HttpServletRequest request,HttpSession session){  
  358.     try {  
  359.         String str = tdLawTaskService.importExl(file,session,type);  
  360.         return str;  
  361.     } catch (Exception e) {  
  362.         e.printStackTrace();  
  363.         return e.getMessage();  
  364.     }  
  365. }  
  366. service  
  367. public String importExl(MultipartFile file,HttpSession session,String type);  
  368.   
  369. /** 
  370.  * @Method_Name: importExl 
  371.  * @Description: 導(dǎo)入 
  372.  */  
  373. public String importExl(MultipartFile file,HttpSession session,String type){  
  374.     String str = "";  
  375.     if(file!=null){  
  376.         ImportExcel impexc = new ImportExcel();  
  377.         //創(chuàng)建時(shí)間  
  378.         String createdate = DateTimeUtil.getDateTime();  
  379.         try {  
  380.             List<String> list = impexc.readExcelContent(file.getInputStream());//讀取Excel數(shù)據(jù)內(nèi)容  
  381.             String sql_head ="INSERT into td_law_sss (ceshi1,ceshi2,ceshi3)VALUES ";  
  382.             for (int i = 0; i < list.size(); i++) {  
  383.                 String[] sourceStrArray = list.get(i).split(",",-1);     
  384.               //判斷 空行 跳過(guò)  
  385.                 if(StrUtil.konghang(sourceStrArray)){  
  386.                     continue;  
  387.                 }  
  388.                 str =str+ "('"+sourceStrArray[0]+"'," +"'"+sourceStrArray[1]+"','"+sourceStrArray[2]+"'), ";  
  389.             }  
  390.             sqlMapper.insert(sql_head+str.substring(0, str.length()-2)+";");  
  391.         } catch (IOException e) {  
  392.             e.printStackTrace();  
  393.         }  
  394.     }  
  395.     return "0";  
  396. }  
  397.   
  398. ImportExcel.java類(lèi)Start  
  399. /** 
  400.  * 讀取Excel數(shù)據(jù)內(nèi)容 
  401.  * @param InputStream 
  402.  * @return Map 包含單元格數(shù)據(jù)內(nèi)容的Map對(duì)象 
  403.  */  
  404. public List<String> readExcelContent(InputStream is) {  
  405. //  Map<Integer, String> content = new HashMap<Integer, String>();  
  406.     List<String> content = new ArrayList<String>();  
  407.     String str = "";  
  408.     try {  
  409.         fs = new POIFSFileSystem(is);  
  410.         wb = new HSSFWorkbook(fs);  
  411.     } catch (IOException e) {  
  412.         e.printStackTrace();  
  413.     }  
  414.     sheet = wb.getSheetAt(0);  
  415.     // 得到總行數(shù)  
  416.     int rowNum = sheet.getLastRowNum();  
  417.     row = sheet.getRow(0);  
  418.     //獲取不為空的列個(gè)數(shù)  
  419.     int colNum = row.getPhysicalNumberOfCells();  
  420.     // 正文內(nèi)容應(yīng)該從第二行開(kāi)始,第一行為表頭的標(biāo)題  
  421.     for (int i = 1; i <= rowNum; i++) {  
  422.         row = sheet.getRow(i);  
  423.       //防止中間某行沒(méi)有內(nèi)容  
  424.         int flag = 0;  
  425.         if(null!=row){  
  426.             flag = 1;  
  427.         }  
  428.         if(flag == 0){  
  429.             continue;  
  430.         }  
  431.         int j = 0;  
  432.         while (j < colNum) {  
  433.             // 每個(gè)單元格的數(shù)據(jù)內(nèi)容用"-"分割開(kāi),以后需要時(shí)用String類(lèi)的replace()方法還原數(shù)據(jù)  
  434.             // 也可以將每個(gè)單元格的數(shù)據(jù)設(shè)置到一個(gè)javabean的屬性中,此時(shí)需要新建一個(gè)javabean  
  435.             // str += getStringCellValue(row.getCell((short) j)).trim() +  
  436.             // "-";  
  437.             //得到Excel工作表指定行的單元格:row.getCell((short) j  
  438.             str += getCellFormatValue(row.getCell((short) j)).trim() + ","; //格式化數(shù)據(jù)  
  439.             j++;  
  440.         }  
  441.         content.add(str);  
  442.         str = "";  
  443.     }  
  444.     return content;  
  445. }  
  446.   
  447. /** 
  448.  * 根據(jù)HSSFCell類(lèi)型設(shè)置數(shù)據(jù) 
  449.  * @param cell 
  450.  * @return 
  451.  */  
  452. private String getCellFormatValue(HSSFCell cell) {  
  453.     String cellvalue = "";  
  454.     if (cell != null) {  
  455.         // 判斷當(dāng)前Cell(單元格)的Type  
  456.         switch (cell.getCellType()) {  
  457.         // 如果當(dāng)前Cell的Type為NUMERIC  
  458.         case HSSFCell.CELL_TYPE_NUMERIC:  
  459.         case HSSFCell.CELL_TYPE_FORMULA: {  
  460.             // 判斷當(dāng)前的cell是否為Date  
  461.             if (HSSFDateUtil.isCellDateFormatted(cell)) {  
  462.                 // 如果是Date類(lèi)型則,轉(zhuǎn)化為Data格式  
  463.                   
  464.                 //方法1:這樣子的data格式是帶時(shí)分秒的:2011-10-12 0:00:00  
  465.                 //cellvalue = cell.getDateCellValue().toLocaleString();  
  466.                   
  467.                 //方法2:這樣子的data格式是不帶帶時(shí)分秒的:2011-10-12  
  468.                 Date date = cell.getDateCellValue();  
  469.                 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");  
  470.                 cellvalue = sdf.format(date);  
  471.                   
  472.             }  
  473.             // 如果是純數(shù)字  
  474.             else {  
  475.                 // 取得當(dāng)前Cell的數(shù)值  
  476.                 //cellvalue = String.valueOf(cell.getNumericCellValue());  
  477.                 DecimalFormat df = new DecimalFormat("0");    
  478.                 cellvalue = df.format(cell.getNumericCellValue());   
  479.             }  
  480.             break;  
  481.         }  
  482.         // 如果當(dāng)前Cell的Type為STRIN  
  483.         case HSSFCell.CELL_TYPE_STRING:  
  484.             // 取得當(dāng)前的Cell字符串  
  485.             cellvalue = cell.getRichStringCellValue().getString();  
  486.             break;  
  487.         // 默認(rèn)的Cell值  
  488.         default:  
  489.             cellvalue = " ";  
  490.         }  
  491.     } else {  
  492.         cellvalue = "";  
  493.     }  
  494.     return cellvalue;  
  495. }  
  496. ImportExcel.java類(lèi)end  
  497.   
  498. //StrUtil類(lèi)中導(dǎo)入時(shí)判斷空行  
  499. public static boolean konghang(String[] content){    
  500.     int flag = 0;  
  501.     for( int t=0;t<content.length;t++){  
  502.         if(!"".equals(content[t])&&content[t] != null){  
  503.             flag=1;  
  504.             break;  
  505.         }  
  506.     }  
  507.     if(flag==0){  
  508.         return true;  
  509.     }  
  510.     return false;  
  511. }  


本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶(hù)發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
Java創(chuàng)建、重命名、刪除文件和文件夾
SpringMVC 文件上傳配置,多文件上傳,使用的MultipartFile
關(guān)于Java文件路徑問(wèn)題
開(kāi)發(fā)|Springboot簡(jiǎn)單實(shí)現(xiàn)文件上傳
Jsp頁(yè)面實(shí)現(xiàn)文件上傳下載 -下載
ASP.NET上傳文件的幾種方法
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服