W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
bdf2-import模塊所需要的依賴
<dependency> <groupId>com.bstek.bdf2</groupId> <artifactId> bdf2-import</artifactId> <version>2.0.0</version> </dependency>
IExcelProcessor接口
package com.bstek.bdf2.importexcel.processor; import com.bstek.bdf2.importexcel.model.ExcelDataWrapper; /** * 要導入的Excel內容的處理類接口,如果自定義處理類,需要實現(xiàn)此接口 * * @author matt.yao@bstek.com * @since 2.0 */ public interface IExcelProcessor { public String getName(); /** * 執(zhí)行處理Excel內容的方法 * * @param excelDataWrapper * 一個包裝了Excel信息的集合 * @return 導入處理成功返回的記錄數(shù) * @throws Exception */ public int execute(ExcelDataWrapper excelDataWrapper) throws Exception; }
FormatGenderInterceptor
package com.bstek.bdf2.importexcel.interceptor.impl; import org.springframework.stereotype.Service; @Service("bdf2.formatGenderInterceptor") public class FormatGenderInterceptor extends RequiredInterceptor { public Object execute(Object cellValue) throws Exception { super.execute(cellValue); if ("男".equals(cellValue)) { return "Y"; } else { return "N"; } } public String getName() { return "格式化性別[男=Y,女=N]"; } }
屬性名 | 類型 | 默認值 | 描述 |
excelModelId | String | 空 | 定義導入模板時指定的方案編號 |
startRow | int | 空 | excel的開始行,如果不指定默認值,默認第一行開始解析 |
endRow | int | 空 | excel的結束行,如果不指定默認值,系統(tǒng)自動判斷excel的結束行 |
showImportData | boolean | true | 是否在線預覽導入的數(shù)據(jù),默認true |
bigData | boolean | false | 如果數(shù)據(jù)量比較大,可以設置為true,解析的excel單元格值類型為字符串 |
var importExcelAction=view.get("#importExcelActionDemo");
importExcelAction.set("excelModelId","0001");
importExcelAction.execute(function(arg){
dorado.MessageBox.alert("成功解析導入[" + arg + "]數(shù)據(jù)!");
})
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: