Exporting table of canvas to excel or pdf

Viewed 26

i have a table with 1 td on each row that td contains a canvas element i want to export the whole table to excel or pdf i tried : it output an image with all rows successfully but it didn't work if the number of rows is greater than 1000

html2canvas($('#codes3').get(0)).then( function (canvas) {
                var a = document.createElement('a');
                a.href = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
                a.download = 'qrcodes.png';
                a.click();  
            });

and i tried and it get an empty excel sheet

        let table =$("#codes3");
html2canvas($('#codes3').get(0)).then( function (canvas) {
            var a = document.createElement('a'); 
            TableToExcel.convert(table[0], { // html code may contain multiple tables so here we are refering to 1st table tag
            name: $("#courseName").val(), // fileName you could use any name
            sheet: {
                name: 'Sheet 1' // sheetName
            }
        });
        });
0 Answers
Related