fix: Export csv file can run program for windows

pull/13029/head
Bai 2024-04-15 19:30:03 +08:00 committed by 老广
parent ccf6b00084
commit b8449a6efa
1 changed files with 8 additions and 1 deletions

View File

@ -23,7 +23,14 @@ class CSVFileRenderer(BaseFileRenderer):
self.writer = csv_writer
def write_row(self, row):
self.writer.writerow(row)
row_escape = []
for d in row:
if isinstance(d, str) and d.strip().startswith(('=', '@')):
d = "'{}".format(d)
row_escape.append(d)
else:
row_escape.append(d)
self.writer.writerow(row_escape)
def get_rendered_value(self):
value = self.buffer.getvalue()