SheetJS & Error: Sheet names cannot exceed 31 chars
SheetJS
Error: Sheet names cannot exceed 31 chars
title + version

https://github.com/SheetJS/js-xlsx/issues/870
https://github.com/SheetJS/js-xlsx/commit/aff7b952720a466bb739ffbbe1cb5d1f9635dcb5
solution
https://support.office.com/en-us/article/Rename-a-worksheet-3F1F7148-EE83-404D-8EF0-9FF99FBAD1F9
export-excel.js
"use strict";
/**
* @description export table to excel with HTML5 Bolb!
* @author xgqfrms 2018.02.05
* @param {String} type
* @param {String} uid
* @param {String} title
* @param {Boolean} debug
*/
const exportExcel = (
uid = `data-table`,
title = `excel-title`,
type = `xlsx`,
debug = false
) => {
if (debug) {
console.log(`uid= `, uid);
console.log(`type = `, type);
console.log(`title = `, title);
}
// fixed bug: error = Error: Sheet names cannot exceed 31 chars
const short_mock_title = `xgqfrms`;
let result = ``;
try {
let elt = document.querySelector(uid),
wb = XLSX.utils.table_to_book(
elt,
{
// sheet: "Sheet JS",// excel sheet name
// sheet: title,
// fixed bug: error = Error: Sheet names cannot exceed 31 chars
sheet: short_mock_title,
}
);
if (debug) {
console.log(`document.querySelector(uid) = `, elt);
}
result = XLSX.writeFile(
wb,
`${title}.${type}`,
// `${short_mock_title}.${type}`,
);
// console.log(`result =`, result);
// bolb
// bolb to url
// true title name
return result;
} catch (error) {
console.log(`export error = `, error);
}
};
export {exportExcel};
export default exportExcel;
old version
"use strict";
/**
* @description export table to excel with HTML5 Bolb!
* @author xgqfrms 2018.02.05
* @param {String} type
* @param {String} uid
* @param {String} title
* @param {Boolean} debug
*/
const exportExcel = (
uid = `data-table`,
title = `excel-title`,
type = `xlsx`,
debug = false
) => {
if (debug) {
console.log(`uid= `, uid);
console.log(`type = `, type);
console.log(`title = `, title);
}
// fixed bug: error = Error: Sheet names cannot exceed 31 chars
const short_mock_title = `xgqfrms`;
let result = ``;
try {
let elt = document.querySelector(uid),
wb = XLSX.utils.table_to_book(
elt,
{
// sheet: "Sheet JS",// excel sheet name
// sheet: title,
// fixed bug: error = Error: Sheet names cannot exceed 31 chars
sheet: short_mock_title,
}
);
if (debug) {
console.log(`document.querySelector(uid) = `, elt);
}
result = XLSX.writeFile(
wb,
`${title}.${type}`,
// true title name
);
return result;
} catch (error) {
console.log(`error = `, error);
}
};
export {exportExcel};
export default exportExcel;
download pdf & rename
seeing comments
download image & rename
seeing comments
SheetJS & Error: Sheet names cannot exceed 31 chars的更多相关文章
- <command-line>:0: error: macro names must be identifiers
编译时的出错信息:<command-line>:0: error: macro names must be identifiers 原因: You have a -D flag with ...
- SharePoint 2013 Error - File names can't contain the following characters: & " ? < > # {} % ~ / \.
错误截图: 错误信息: --------------------------- Message from webpage --------------------------- File names ...
- Error: member names cannot be the same as their enclosing type
在编译的时候会遇到如下问题:member names cannot be the same as their enclosing type 原因:方法名和类名不能一样,如果一样就是一个构造函数.而构造 ...
- VS2008 error PRJ0002 : 错误的结果 31 (从“C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\rc.exe”返回)。
解决方案,选择属性->配置属性->清单工具->输入和输出->嵌入清单,把是改成否
- linux系统中errno与error对照表
1.使用了一个小程序输出所有的errno对应的error字符串,代码如下 #include <errno.h> void showError(int err){ printf(" ...
- BIP Requests Are Failing With Error "OPP Error Oracle.apps.xdo.XDOException: Error Creating Lock Fil
In this Document Symptoms Cause _afrLoop=975833031487795&id=1512691.1&displayIndex=1&a ...
- BIP Requests Are Failing With Error "OPP Error Oracle.apps.xdo.XDOException: Error Creating Lock Fil
In this Document Symptoms Cause Solution References Applies to: BI Publisher (formerly XML P ...
- Manjaro下带供电的USB Hub提示error -71
问题描述 这款USB Hub是绿联出的1转7带供电的白色款. 在lsusb中显示为 Bus 004 Device 023: ID 05e3:0616 Genesys Logic, Inc. hub B ...
- tp3.2 phpexcel 简单导出多个sheet(execl表格)
参考链接:https://blog.csdn.net/u011341352/article/details/70211962 以下是公共类PHPExcel.php文件: // 开始 <?php/ ...
随机推荐
- Tomcat启动排查
Tomcat启动排查 一.参考 https://blog.csdn.net/baidu_32739019/article/details/64155136
- ElasticSearch High Level REST API【7】聚合
获取平均值聚合示例,最大值.最小值.求和类似 public void aggregation(){ RestHighLevelClient client = elasticClient.getRest ...
- JS之执行上下文
执行上下文(execution context),是JS中的一个很重要的概念.它对于我们理解函数定义,执行时都做了什么有着很大的意义.理解它我们才能明白我们常说的函数声明提升,作用域链,闭包等原理. ...
- PHP continue和break的用法(深入理解)
对于刚入门的PHP童鞋们来说,在循环体中的continue和break的作用总是分不清到底是什么意思, 怎么用, 两者到底有什么区别? 接下来说几个例子,其实它们是很好区分的. <?php $t ...
- 7-1 寻找大富翁 PTA 堆排序
7-1 寻找大富翁 (25 分) 胡润研究院的调查显示,截至2017年底,中国个人资产超过1亿元的高净值人群达15万人.假设给出N个人的个人资产值,请快速找出资产排前M位的大富翁. 输入格式: 输入首 ...
- POJ:2100-Graveyard Design(尺取)
Graveyard Design Time Limit: 10000MS Memory Limit: 64000K Total Submissions: 8504 Accepted: 2126 Cas ...
- POJ:2377-Bad Cowtractors
传送门:http://poj.org/problem?id=2377 Bad Cowtractors Time Limit: 1000MS Memory Limit: 65536K Total Sub ...
- 笔记-scrapy-pipeline
笔记-scrapy-pipeline 1.简介 scrapy抓取数据后,使用yield发送item对象至pipeline,pipeline顺序对item进行处理. 一般用于: 清洗,验证,检查数据: ...
- jdk1.8源码学习笔记
前言: 前一段时间开始学习了一些基本的数据结构和算法,算是弥补了这方面的知识短板,但是仅仅是对一些算法的了解,目前工作当中也并没有应用到这些,因此希望通过结合实际例子来学习,巩固之前学到的内容,思前想 ...
- TouTiao开源项目 分析笔记7 加载数据的过程
1.以新闻页中的段子数据显示为例 1.1.首先执行InitApp==>SplashActivity. 因为在AndroidManifest.xml中定义了一个<intent-filter& ...