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/ ...
随机推荐
- pooling
转自:http://www.gageet.com/2014/09182.php 本文部分参考了:http://www.zhihu.com/question/23437871 卷积层是对图像的一个邻域进 ...
- 【Java】多线程相关复习—— 线程的创建、名字、运行情况以及顺序控制(join方法) 【一】
一.创建线程的三种方式 · 继承Thread类 · 实现Runnable接口 · 实现Callable接口 二. 线程状态 · 线程名字 getName() · 线程活动情况 isAlive() · ...
- Linux文件服务器实战(系统用户)
ftp匿名用户设置完成之后任何人都可以访问服务器端文件,目录,甚至可以修改删除文件和目录,,那如何存放私密文件并保证文件或者目录专属于拥有者呢,就需要使用vsftp系统用户来实现了. 1.在linux ...
- linux基础目录
第1章 linux目录结构 1.1 linux目录结构的特点 一切皆文件 1)倒挂的树状结构 一切从根开始 2)linux每个目录可以挂载在不同的设备(磁盘)上.windows不容易做到. /da ...
- 简单了解一下oracle中的显示游标和存储过程
游标 游标主要分两类动态和静态游标,静态游标是编译时知道明确的select语句的游标,静态游标分类两种,显示游标和静态游标,这里只说显示游标 显示游标 declare name emp.ename%t ...
- js常用的2中排序方法:冒泡排序和快速排序
冒泡排序:例如9 4 5 6 8 3 2 7 10 1 首先:9和4比较 4放前 4 9 5 6 8 3 2 7 10 1 4和5比较 4不动 4 9 5 6 8 3 2 7 10 1 ...
- float 浮动详解
浮动(float):浮动原先设定时主要是用于文本环绕图像设定的,后来发现其在css布局中有很大的帮助,故渐渐使用浮动. 浮动后的元素脱离了文档的普通流,使得浮动的元素不占据文档的位置,其他元素可以覆盖 ...
- 【转载】谈MongoDB的应用场景
引用:http://blog.csdn.net/adparking/article/details/38727911 MongoDB的应用场景在网上搜索了下,很少介绍关于传统的信息化应用中如何使用Mo ...
- Laravel系列之环境搭建 — VirtualBox+Vagrant+Homestead
一.为啥需要搭建环境 为了解决环境不统一问题,所以要搭建这么个玩意儿 二.步骤 Laravel对环境有所要求(不使用Homestead情况下),具体参考官网 使用Homestead步骤 1. Hom ...
- leetcode 【 Linked List Cycle 】 python 实现
题目: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using ...