function export2Word() {
var html, link, blob, url, css;
css = (
'<style> table { border-collapse: collapse; border-style:none; } .tables td,th{border:1px solid black;}' +
//'@page WordSection1{size: 841.95pt 595.35pt;mso-page-orientation: landscape;}' +
//'div.WordSection1 {page: WordSection1;} ' +
'</style>'
);
html = document.getElementById("tblPrint").outerHTML;
blob = new Blob(['\ufeff', css + html], {
type: 'application/msword'
});
url = URL.createObjectURL(blob);
link = document.createElement('A');
link.href = url;
link.download = 'Document'; // default name without extension
document.body.appendChild(link);
if (navigator.msSaveOrOpenBlob)
navigator.msSaveOrOpenBlob(blob, 'Document.doc'); // IE10-11
else link.click(); // other browsers
document.body.removeChild(link);
};
I want to export table to MS-Word when I tried then not showing any table structure just showing data
and I used page break for new rollno using like <div style="page-break-after:always;"> </div>
this also not working
what is wrong in my code? and what to do for page break in ms-word?
Thanks in advance