Answers for "export html table to excel"

1

html table to excel javascript

<script type="text/javascript">
var tableToExcel = (function() {
  var uri = 'data:application/vnd.ms-excel;base64,'
    , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>'
    , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
    , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
  return function(table, name) {
    if (!table.nodeType) table = document.getElementById(table)
    var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
    window.location.href = uri + base64(format(template, ctx))
  }
})()
</script>
Posted by: Guest on July-01-2020
0

export html to excel

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>jQuery Shield UI Demos</title>
    <link id="themecss" rel="stylesheet" type="text/css" href="//www.shieldui.com/shared/components/latest/css/light/all.min.css" />
    <script type="text/javascript" src="//www.shieldui.com/shared/components/latest/js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="//www.shieldui.com/shared/components/latest/js/shieldui-all.min.js"></script>
</head>
<body class="theme-light">
<!-- include the JSZip library for XLSX support -->
<script type="text/javascript" src="//www.shieldui.com/shared/components/latest/js/jszip.min.js"></script>
<script type="text/javascript" src="/Content/Json/gridData.js"></script>
<div id="grid"></div>
<script type="text/javascript">
    jQuery(function ($) {
        $("#grid").shieldGrid({
            dataSource: {
                data: gridData
            },
            paging: {
                pageSize: 20,
                pageLinksCount: 10
            },
            columns: [
                { field: "id", width: "70px", title: "ID" },
                { field: "name", title: "Person Name" },
                { field: "company", title: "Company Name" },
                { field: "email", title: "Email Address", width: "270px" }
            ],
            toolbar: [
                {
                    buttons: [
                        {
                            commandName: "excel",
                            caption: '<span class="sui-sprite sui-grid-icon-export-excel"></span> <span class="sui-grid-button-text">Export to Excel</span>'
                        }
                    ]
                }
            ],
            exportOptions: {
                proxy: "/filesaver/save",
                excel: {
                    fileName: "shieldui-export",
                    author: "John Smith",
                    dataSource: {
                        data: gridData
                    },
                    readDataSource: true
                }
            }
        });
    });
</script>
</body>
</html>
Posted by: Guest on August-13-2021
0

download html table to excel

ob_end_clean();
ob_start();
Excel::create($filename, function($excel) use($records, $sheetname, $data) {}
Posted by: Guest on May-26-2021
-1

export html table to excel

saveAsExcel('tableselector', 'table.xls')
Posted by: Guest on March-19-2021
-2

export html table to excel

<script src="saveAsExcel.js"></script>
Posted by: Guest on March-19-2021

Browse Popular Code Answers by Language