From b756511fbd6801dcdecd0cd84fb661c8355114d5 Mon Sep 17 00:00:00 2001 From: aldo Date: Fri, 15 Nov 2024 19:19:39 -0600 Subject: [PATCH] Fixed excel compatability issues. --- BackEndFlask/Functions/exportCsv.py | 3 ++- .../View/Admin/View/ViewAssessmentTask/ViewAssessmentTasks.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BackEndFlask/Functions/exportCsv.py b/BackEndFlask/Functions/exportCsv.py index 14a9a6727..78a981c12 100644 --- a/BackEndFlask/Functions/exportCsv.py +++ b/BackEndFlask/Functions/exportCsv.py @@ -110,6 +110,7 @@ def return_csv_str(self) -> str: """ # Writting a common identifying data. + self._writer.writerow(['\ufeff']) # A dom that helps excel auto use utf-8. Downside is that it uses up a line. self._writer.writerow(["Course Name"]) self._writer.writerow([get_course_name_by_at_id(self._at_id)]) self._writer.writerow([' ']) @@ -192,7 +193,7 @@ def __init__(self, at_id: int) -> None: at_id: """ super().__init__(at_id) - self.__checkmark = "✔" + self.__checkmark = '\u2713' self.__crossmark = " " def _format(self) -> None: diff --git a/FrontEndReact/src/View/Admin/View/ViewAssessmentTask/ViewAssessmentTasks.js b/FrontEndReact/src/View/Admin/View/ViewAssessmentTask/ViewAssessmentTasks.js index 4c0c674ea..e45b01eff 100644 --- a/FrontEndReact/src/View/Admin/View/ViewAssessmentTask/ViewAssessmentTasks.js +++ b/FrontEndReact/src/View/Admin/View/ViewAssessmentTask/ViewAssessmentTasks.js @@ -52,7 +52,7 @@ class ViewAssessmentTasks extends Component { if(this.state.isLoaded && this.state.csvCreation) { const fileData = this.state.csvCreation["csv_data"]; - const blob = new Blob([fileData], { type: 'csv' }); + const blob = new Blob([fileData], { type: 'text/csv;charset=utf-8;' }); const url = URL.createObjectURL(blob); const link = document.createElement("a");