JavaScript - Comprencion de codigo

 
Vista:
sin imagen de perfil
Val: 1
Ha aumentado su posición en 23 puestos en JavaScript (en relación al último mes)
Gráfica de JavaScript

Comprencion de codigo

Publicado por Diego A. (1 intervención) el 23/10/2017 23:35:14
hola a todos.
tengo el siguiente codigo para para pasar una tabla de php a excel, es de javascript y necesito ayuda para comprenderlo y modificarlo para ver si puedo dividir la tabla que toma de php en varias hojas de caculo segun la fecha que tenga cada registro xfavor ayudenme se lo agradesco

1
2
3
4
5
6
7
8
9
10
11
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]--></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))
  }
})()
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder