EAS BOS Excel에서 데이터 가져오기
package com.kingdee.eas.ts.common.utils;
import java.util.Map;
import com.kingdee.bos.ctrl.kdf.table.IRow;
import com.kingdee.bos.ctrl.kdf.table.KDTable;
import com.kingdee.bos.dao.IObjectCollection;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.eas.ec.common.client.IExcelImpProcess;
import com.kingdee.eas.framework.client.CoreUI;
/**
*
* com.kingdee.eas.ec.common.client.IExcelImpProcess
*/
public class CustomExcelImpProcess implements IExcelImpProcess {
private CoreUI owner; //
private String strFullName; //Excel
private String sheetName; //
private KDTable table; //
public CustomExcelImpProcess(CoreUI owner, String strFullName, String sheetName, KDTable table){
this.owner = owner;
this.strFullName = strFullName;
this.sheetName = sheetName;
this.table = table;
}
/**
* Excel
*/
@Override
public void addRow(Object[] objArr) throws Exception {
if(objArr == null || objArr.length == 0) return;
IRow row = table.addRow();
Object obj = null;
String key = null;
for(int i = 0; i
2. 인터페이스에 가져오기 버튼 추가 및 이벤트 추가
protected void actionImportExcel_actionPerformed(ActionEvent e) throws Exception{
String strFullPath = EcFileUtil.getSelectFile(this, false, "xls");
if (strFullPath != null) {
IExcelImpProcess process = new CustomExcelImpProcess(this, strFullPath, " ", this.kdtEntry);
ExcelUtil.impDataToExcel(process);
}
}