|
@@ -9,7 +9,6 @@ import { Message, MessageBox } from 'element-ui'
|
|
*/
|
|
*/
|
|
const downTable = (id, width, name) => {
|
|
const downTable = (id, width, name) => {
|
|
name = name + '.xlsx' || 'test.xlsx'
|
|
name = name + '.xlsx' || 'test.xlsx'
|
|
- console.log(document.getElementById(id))
|
|
|
|
const excel = exportExcel(document.getElementById(id), width, name)
|
|
const excel = exportExcel(document.getElementById(id), width, name)
|
|
if (excel) {
|
|
if (excel) {
|
|
Message({
|
|
Message({
|
|
@@ -34,7 +33,26 @@ import { Message, MessageBox } from 'element-ui'
|
|
} else {
|
|
} else {
|
|
wb = XLSX.utils.table_to_book(ele);
|
|
wb = XLSX.utils.table_to_book(ele);
|
|
}
|
|
}
|
|
|
|
+ console.log(wb.Sheets.Sheet1, Object.keys(wb.Sheets.Sheet1).filter(item => /^\D\d$/.test(item)))
|
|
|
|
+ // 修改表格内容宽度
|
|
wb.Sheets.Sheet1['!cols'] = wscols;
|
|
wb.Sheets.Sheet1['!cols'] = wscols;
|
|
|
|
+ // 新增样式 xlsl-style引入有问题暂时注释
|
|
|
|
+ // const Sheet1Key = wb.Sheets.Sheet1
|
|
|
|
+ // Object.keys(Sheet1Key).forEach(item => {
|
|
|
|
+ // if (/^\D\d$/.test(item)) {
|
|
|
|
+ // Sheet1Key[item].s = {
|
|
|
|
+ // font: {
|
|
|
|
+ // color: {
|
|
|
|
+ // rgb: 'FF4F81BD' //字体颜色
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
|
|
+ // alignment: {
|
|
|
|
+ // horizontal: 'center'
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ console.log(wb.Sheets.Sheet1)
|
|
/* 获取二进制字符串作为输出 */
|
|
/* 获取二进制字符串作为输出 */
|
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array', cellDates: true })
|
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array', cellDates: true })
|
|
try {
|
|
try {
|