diff --git a/base/src/test/user_model/test_paste_csv.rs b/base/src/test/user_model/test_paste_csv.rs index 3331ec7..4b2ff7e 100644 --- a/base/src/test/user_model/test_paste_csv.rs +++ b/base/src/test/user_model/test_paste_csv.rs @@ -167,7 +167,7 @@ fn copy_paste_internal() { let copy = model.copy_to_clipboard().unwrap(); assert_eq!( copy.csv, - "42\t127\n\"A season of faith\t \"\"perfection\"\"\"\t\n" + "42\t127\n\"A season of faith\t \"\"perfection\"\"\"" ); assert_eq!(copy.range, (1, 1, 2, 2)); diff --git a/base/src/user_model/common.rs b/base/src/user_model/common.rs index a7a5b34..ecc9d41 100644 --- a/base/src/user_model/common.rs +++ b/base/src/user_model/common.rs @@ -1641,7 +1641,7 @@ impl UserModel { .map_err(|e| format!("Error converting from utf8: '{e}'"))?; Ok(Clipboard { - csv, + csv: csv.trim().to_string(), data, sheet, range: (row_start, column_start, row_end, column_end), diff --git a/webapp/IronCalc/src/components/Workbook/Workbook.tsx b/webapp/IronCalc/src/components/Workbook/Workbook.tsx index bdd2bed..70db123 100644 --- a/webapp/IronCalc/src/components/Workbook/Workbook.tsx +++ b/webapp/IronCalc/src/components/Workbook/Workbook.tsx @@ -473,7 +473,7 @@ const Workbook = (props: { model: Model; workbookState: WorkbookState }) => { sheet, clipboardId, }); - event.clipboardData.setData("text/plain", data.csv); + event.clipboardData.setData("text/plain", data.csv.trim()); event.clipboardData.setData("application/json", clipboardJsonStr); event.preventDefault(); event.stopPropagation();