项目需要,今天写了个前端导出Excel的方法 /** * 通过索引获取对应的Excel列名 * 索引从0开始,返回形如 A,B,C,...,Z,AA,AB,...,AZ,BA,...,ZZ,AAA,AAB,...... */var getExcelColumnName = function (index) { var colName = ‘‘; if (index >= 26) { colName = getExcelColumnName(index / 26 - 1); colName += String.fromCharCode(65 + index % 26); } else { colName += String.fromCharCode(65 + index); } return colName;};
时间: 2024-10-12 23:53:17