轉載地址:http://www.cnblogs.com/fengwenit/p/4268549.html
有一個實體的子表數據量太大,於是客戶想用execel來導入實體數據。首先想到的是用系統自帶的Import Data,客戶嫌太麻煩,比如lookup字段要做map等。
下面是具體的實現步驟:
一、定義excel數據模板
1. 利用系統自帶的Download Template For Import下載系統自帶的模板
2. 去掉不需要的列,比如有些列是自動計算,自動賦值
3. 保存爲excel文件,並copy到crm server裏的isv目錄下
4. 定義一個按鈕,並指定調用下面的js:
// export purchase detail template
function downloadDetailTemplate() {
var url = "/ISV/TempDownLoad/OrderDetail.xls";
var hiddenIFrameID = 'hiddenDownloader',
iframe = document.getElementById(hiddenIFrameID);
if (iframe === null) {
iframe = document.createElement('iframe');
iframe.id = hiddenIFrameID;
iframe.style.display = 'none';
document.body.appendChild(iframe);
}
iframe.src = url;
}