I'm trying to get the number of columns in a file, the method where the rows of tables for html are created "make_html_row" does not contain the property of number of columns, create a new function that by letter of alphabet gives me the number as test, everything good and functional, I pass it to ws ["! cols"], but when reading the array I can not get to this data, I can list it in the console.log but when trying to get to this property it gives me undefined , try to create another new property, list me the amount in console.log but I still do not get to the data, can someone help me?
xlsx.js
function make_html_row(ws, r, R, o) {
var M = (ws['!merges'] ||[]);
var oo = [];
var nullcell = "<td>" + (o.editable ? '<span contenteditable="true"></span>' : "" ) + "</td>";
for(var C = r.s.c; C <= r.e.c; ++C) {
var RS = 0, CS = 0;
for(var j = 0; j < M.length; ++j) {
if(M[j].s.r > R || M[j].s.c > C) continue;
if(M[j].e.r < R || M[j].e.c < C) continue;
if(M[j].s.r < R || M[j].s.c < C) { RS = -1; break; }
RS = M[j].e.r - M[j].s.r + 1; CS = M[j].e.c - M[j].s.c + 1; break;
}
if(RS < 0) continue;
var coord = encode_cell({r:R,c:C});
var cell = o.dense ? (ws[R]||[])[C] : ws[coord];
if(!cell || cell.v == null) { oo.push(nullcell); continue; }
/* TODO: html entities */
var w = cell.h || escapexml(cell.w || (format_cell(cell), cell.w) || "");
var sp = {};
if(RS > 1) sp.rowspan = RS;
if(CS > 1) sp.colspan = CS;
if(o.editable) w = '<span contenteditable="true">' + w + '</span>';
sp.id = "sjs-" + coord;
oo.push(writextag('td', w, sp));
}
ws["colNumber"]=columnNumber(encode_col(C));
var preamble = "<tr>";
return preamble + oo.join("") + "</tr>";
}
function columnNumber(txt, literal){
if(!literal) txt= txt.toLowerCase();
return txt.split('').map(function(c){
return 'abcdefghijklmnopqrstuvwxyz'.indexOf(c) || (literal? c: '');
}).join(' ');
}
MyFile.js
workbook.SheetNames.forEach(function(sheetName) {
console.log(workbook)//node colNumber appears in Sheets
var Name ="";
Name = sheetName.toString();
var arrCols = workbook.Sheets[Name]; //this works fine
console.log(arrCols);
console.log(arrCols.colNumber);//not working
tblList.push([{nombre:sheetName, cols:arrCols}]);
var htmlstr = X.write(workbook, {sheet:sheetName, type:'binary', bookType:'html'});
strFile+=htmlstr;
n++;
});
I'm trying to get the number of columns in a file, the method where the rows of tables for html are created "make_html_row" does not contain the property of number of columns, create a new function that by letter of alphabet gives me the number as test, everything good and functional, I pass it to ws ["! cols"], but when reading the array I can not get to this data, I can list it in the console.log but when trying to get to this property it gives me undefined , try to create another new property, list me the amount in console.log but I still do not get to the data, can someone help me?
xlsx.js
MyFile.js