1<script type="text/javascript">
2var tableToExcel = (function() {
3 var uri = 'data:application/vnd.ms-excel;base64,'
4 , 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}{table}5{ return window.btoa(unescape(encodeURIComponent(s))) }
6 , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
7 return function(table, name) {
8 if (!table.nodeType) table = document.getElementById(table)
9 var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
10 window.location.href = uri + base64(format(template, ctx))
11 }
12})()
13</script>
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="utf-8" />
5 <title>jQuery Shield UI Demos</title>
6 <link id="themecss" rel="stylesheet" type="text/css" href="//www.shieldui.com/shared/components/latest/css/light/all.min.css" />
7 <script type="text/javascript" src="//www.shieldui.com/shared/components/latest/js/jquery-1.11.1.min.js"></script>
8 <script type="text/javascript" src="//www.shieldui.com/shared/components/latest/js/shieldui-all.min.js"></script>
9</head>
10<body class="theme-light">
11<!-- include the JSZip library for XLSX support -->
12<script type="text/javascript" src="//www.shieldui.com/shared/components/latest/js/jszip.min.js"></script>
13<script type="text/javascript" src="/Content/Json/gridData.js"></script>
14<div id="grid"></div>
15<script type="text/javascript">
16 jQuery(function ($) {
17 $("#grid").shieldGrid({
18 dataSource: {
19 data: gridData
20 },
21 paging: {
22 pageSize: 20,
23 pageLinksCount: 10
24 },
25 columns: [
26 { field: "id", width: "70px", title: "ID" },
27 { field: "name", title: "Person Name" },
28 { field: "company", title: "Company Name" },
29 { field: "email", title: "Email Address", width: "270px" }
30 ],
31 toolbar: [
32 {
33 buttons: [
34 {
35 commandName: "excel",
36 caption: '<span class="sui-sprite sui-grid-icon-export-excel"></span> <span class="sui-grid-button-text">Export to Excel</span>'
37 }
38 ]
39 }
40 ],
41 exportOptions: {
42 proxy: "/filesaver/save",
43 excel: {
44 fileName: "shieldui-export",
45 author: "John Smith",
46 dataSource: {
47 data: gridData
48 },
49 readDataSource: true
50 }
51 }
52 });
53 });
54</script>
55</body>
56</html>
1ob_end_clean();
2ob_start();
3Excel::create($filename, function($excel) use($records, $sheetname, $data) {}
4