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的更多相关文章

  1. <command-line>:0: error: macro names must be identifiers

    编译时的出错信息:<command-line>:0: error: macro names must be identifiers 原因: You have a -D flag with ...

  2. SharePoint 2013 Error - File names can't contain the following characters: & " ? < > # {} % ~ / \.

    错误截图: 错误信息: --------------------------- Message from webpage --------------------------- File names ...

  3. Error: member names cannot be the same as their enclosing type

    在编译的时候会遇到如下问题:member names cannot be the same as their enclosing type 原因:方法名和类名不能一样,如果一样就是一个构造函数.而构造 ...

  4. VS2008 error PRJ0002 : 错误的结果 31 (从“C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\rc.exe”返回)。

    解决方案,选择属性->配置属性->清单工具->输入和输出->嵌入清单,把是改成否

  5. linux系统中errno与error对照表

    1.使用了一个小程序输出所有的errno对应的error字符串,代码如下 #include <errno.h> void showError(int err){ printf(" ...

  6. BIP Requests Are Failing With Error &quot;OPP Error Oracle.apps.xdo.XDOException: Error Creating Lock Fil

    In this Document   Symptoms   Cause   _afrLoop=975833031487795&id=1512691.1&displayIndex=1&a ...

  7. 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 ...

  8. Manjaro下带供电的USB Hub提示error -71

    问题描述 这款USB Hub是绿联出的1转7带供电的白色款. 在lsusb中显示为 Bus 004 Device 023: ID 05e3:0616 Genesys Logic, Inc. hub B ...

  9. tp3.2 phpexcel 简单导出多个sheet(execl表格)

    参考链接:https://blog.csdn.net/u011341352/article/details/70211962 以下是公共类PHPExcel.php文件: // 开始 <?php/ ...

随机推荐

  1. cookie和session的介绍

    1.cookie和session cookie不属于http协议范围,由于http协议无法保持状态,但实际情况,我们却又需要“保持状态”,因此产生cookie. cookie的工作原理是:由服务器产生 ...

  2. 关于 ReactNative 环境搭建之 error: invalid developer directory '/Library/Developer/CommandLineTools' - RN

    简要说明,此次尝试安装 ReactNative 时当前 MacPro 版本为 10.13.6.Xcode 版本为 Version 9.4.1 (9F2000),按照官方的完整原生环境搭建流程一步步执行 ...

  3. Vue项目架构设计与工程化实践

    摘自Berwin<Vue项目架构设计与工程化实践>github.com/berwin/Blog/issues/14 1.Vue依赖套件 vuex:项目复杂后,用vuex来管理状态 elem ...

  4. Windows下MySQL数据库的安装与关闭开机自启动

    我在学习java,安装数据库时找了很多教程,现在在这里总结一下我安装数据库的过程,我安装的是mysql-5.6.42-winx64版本的. 数据官方下载地址:https://dev.mysql.com ...

  5. LeetCode961 重复 N 次的元素

    问题: 重复 N 次的元素 在大小为 2N 的数组 A 中有 N+1 个不同的元素,其中有一个元素重复了 N 次. 返回重复了 N 次的那个元素. 示例 1: 输入:[1,2,3,3] 输出:3 示例 ...

  6. 微信小程序本地缓存

  7. cookie操作和代理

    cookie操作 爬取豆瓣个人主页 # -*- coding: utf-8 -*- import scrapy class DoubanSpider(scrapy.Spider): name = 'd ...

  8. 虚拟机linux桥接联网问题

    Linux系统为redhat5.8 虚拟机的版本:vm8.0 本人刚刚开始接触linux,今日需要通过linux进行联网,因此也学习了一点点关于虚拟机的联网的知识,在此与大家进行分享,希望大家可以之处 ...

  9. LeetCode summary

    https://www.programcreek.com/2013/08/leetcode-problem-classification/ https://medium.com/algorithms- ...

  10. python-13常用内建模块

    1-datetime #1-获取当前日期和时间 from datetime import datetime now = datetime.now() #当前时间 print(now) #2015-05 ...