From 4940dd4040665d8bed4a7f1279235961cf4bcaa8 Mon Sep 17 00:00:00 2001
From: spiritree <spiritreess@gmail.com>
Date: Thu, 12 Oct 2017 16:22:39 +0800
Subject: [PATCH] fix:fix `undefined` bug in export excel

---
 src/vendor/Export2Excel.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/vendor/Export2Excel.js b/src/vendor/Export2Excel.js
index c6aae141..4370da36 100644
--- a/src/vendor/Export2Excel.js
+++ b/src/vendor/Export2Excel.js
@@ -128,8 +128,12 @@ export function export_json_to_excel(th, jsonData, defaultTitle) {
 
     /*莅丞舟worksheet罸������鎀у�綺�*/
     const colWidth = data.map(row => row.map(val => {
-      /*�ゆ�㊥����減筝㊥��*/
-      if (val.toString().charCodeAt(0) > 255) {
+      /*���ゆ�㊥����減null/undefined*/
+      if (val == null) {
+        return {'wch': 10};
+      }
+      /*���ゆ�㊥����減筝㊥��*/
+      else if (val.toString().charCodeAt(0) > 255) {
         return {'wch': val.toString().length * 2};
       } else {
         return {'wch': val.toString().length};
-- 
GitLab