mirror of https://github.com/jumpserver/jumpserver
fix: 修复命令导出excel格式报错
parent
3f2925116e
commit
a3a591da4b
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue