我将数据保存在数组中,按选定的行获取。想要将它们复制到剪贴板并粘贴到excel中,但格式必须如图所示 enter image description here
但是我将所有内容都放在一行和一个单元格中: enter image description here
如何将它们分开。我的代码:
function Copy () {
var coped = new Array();
$.each(searchGrid.getSelectedRowsData(), function () {
coped.push(this.SerialNumber, this.Model );
});
var dummy = document.createElement("input");
document.body.appendChild(dummy);
dummy.setAttribute("id", "dummy_id");
debugger;
// Output the array into it
document.getElementById("dummy_id").value = coped;
dummy.select();
document.execCommand("copy");
document.body.removeChild(dummy);
};