-1
Excel로 HTML 표를 내보내는 데 필요한 많은 Javascript/jQuery 메소드를 발견했으며, 모두 기본 위치로 다운로드합니다. 누구든지 플러그인을 사용하지 않고 내 보낸 Excel 파일의 고유 한 대상 다운로드 폴더 위치를 설정하는 방법을 알고 있습니까?HTML 표를 Excel로 내보내고 대상 폴더를 설정하십시오.
Excel로 HTML 표를 내보내는 데 필요한 많은 Javascript/jQuery 메소드를 발견했으며, 모두 기본 위치로 다운로드합니다. 누구든지 플러그인을 사용하지 않고 내 보낸 Excel 파일의 고유 한 대상 다운로드 폴더 위치를 설정하는 방법을 알고 있습니까?HTML 표를 Excel로 내보내고 대상 폴더를 설정하십시오.
그것은 다운로드 위치를 설정하는 것은 불가능 a function that opens a "Save As" dialog allowing the user to choose the download location.
function exportToExcel(tableID){
var tab_text="<table border='2px'><tr bgcolor='#87AFC6' style='height: 75px;
text-align: center; width: 250px'>";
var textRange; var j=0;
tab = document.getElementById(tableID); // id of table
for(j = 0 ; j < tab.rows.length ; j++)
{
tab_text=tab_text;
tab_text=tab_text+tab.rows[j].innerHTML.toUpperCase()+"</tr>";
//tab_text=tab_text+"</tr>";
}
tab_text= tab_text+"</table>";
tab_text= tab_text.replace(/<A[^>]*>|<\/A>/g, ""); //remove if u want links in your table
tab_text= tab_text.replace(/<img[^>]*>/gi,""); //remove if u want images in your table
tab_text= tab_text.replace(/<input[^>]*>|<\/input>/gi, ""); //remove input params
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer
{
txtArea1.document.open("txt/html","replace");
txtArea1.document.write('sep=,\r\n' + tab_text);
txtArea1.document.close();
txtArea1.focus();
sa=txtArea1.document.execCommand("SaveAs",true,"asd.xls");
}
else {
sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text));
}
return (sa);
}
발견. 그것은 JS 코드보다 낮은 수준의 브라우저에 의해 –
에 액세스 할 수 있습니다. 어떤 브라우저에서 다운로드 대상 폴더를 지정할 수 있으면 큰 보안 문제가 될 것입니다. 따라서 대답은 " 불가능합니다. " –