fix: 修复命令导出excel格式报错

pull/5291/head
Bai 2020-12-17 14:29:54 +08:00 committed by Jiangjie.Bai
parent 3f2925116e
commit a3a591da4b
1 changed files with 3 additions and 0 deletions

View File

@ -1,5 +1,6 @@
from openpyxl import Workbook
from openpyxl.writer.excel import save_virtual_workbook
from openpyxl.cell.cell import ILLEGAL_CHARACTERS_RE
from .base import BaseFileRenderer
@ -20,7 +21,9 @@ class ExcelFileRenderer(BaseFileRenderer):
self.row_count += 1
column_count = 0
for cell_value in row:
# 处理非法字符
column_count += 1
cell_value = ILLEGAL_CHARACTERS_RE.sub(r'', cell_value)
self.ws.cell(row=self.row_count, column=column_count, value=cell_value)
def get_rendered_value(self):