1.創建模板並放在所在包WEB下自命名的文件內
2.按鈕:
<a class="nui-button" iconCls="icon-upload" onclick="downloadTemplate()">下載模板</a>
以post方法提交表單
<div style="display:none;">
<form id="downloadTemp" method="post">
</form>
</div>
調用頁面流
function downloadTemplate(){
var form = document.getElementById("downloadTemp");
form.action = "com.sgai.fssc.service.hec4cwgx.bgt.importDatas.flow?_eosFlowAction=export0";
form.submit();
}
3.創建頁面流和要用到的邏輯構件
參數name爲模板名稱
邏輯構件:
導出模板後的,模板名稱
4.所調用的java方法
@Bizlet("")
public class FileOperate {
public static final String CONTRIBUTION_COFRAME_UTILS = "org.gocom.components.coframe.dict";
public static final String MODULE_COFRAME = "coframe-config";
public static final String GROUP_EXCEL = "excel-config";
public static final String EXCEL_TEMPLATE_PATH = "excel_template_path";
@Bizlet("")
public String generatePath(String name){
String templateDir = ApplicationContext.getInstance().getWarRealPath()
+ ConfigurationUtil.getContributionConfig(CONTRIBUTION_COFRAME_UTILS, MODULE_COFRAME, GROUP_EXCEL, EXCEL_TEMPLATE_PATH);
String templateFile = templateDir + name;
return templateFile;
}
}