1
我有一個網頁,可以生成大約1000 - 5000條記錄(14列)的報告。代碼:javascript excellentexport blob問題
excel: function(anchor, table, name) {
table = get(table);
var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML};
var hrefvalue = uri.excel + base64(format(template.excel, ctx));
anchor.href = hrefvalue;
// Return true to allow the link to work
return true;
},
如果記錄大約是1500,但是如果它的記錄大於2000,那麼它不起作用。我看到這個帖子how to export table as excel with 10000 to 40000 rows並試圖從我的代碼合併它:
var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML};
var blob = b64toBlob(ctx, "application/vnd.ms-excel");
var blobUrl = URL.createObjectURL(blob);
window.location = blobUrl;
function b64toBlob(b64Data, contentType, sliceSize) {
contentType = contentType || '';
sliceSize = sliceSize || 512;
var byteCharacters = atob(b64Data);
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
var slice = byteCharacters.slice(offset, offset + sliceSize);
var byteNumbers = new Array(slice.length);
for (var i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
var blob = new Blob(byteArrays, {type: contentType});
return blob;
}
我現在可以出口的記錄超過2000條記錄,但是當我打開電子表格,還出口菜單,報表按鈕,文本框進excel和我需要的報告的開始將位於第150行的所有額外的東西出口。
有沒有辦法在excel中刪除導出的UI?