summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-05-08 10:04:24 -0300
committerAndrés <andmarti@gmail.com>2021-05-08 10:04:24 -0300
commitbb778d33a25686e0fa924ee453037a5e104187c2 (patch)
tree42bc432ea3fe85fb63a1dbf4471af7bdca5f743f
parentf9c591171a878ddc52d547cd8d784946f15824bb (diff)
Work on issue 493
-rw-r--r--CHANGES9
-rwxr-xr-xsrc/doc1
-rw-r--r--src/file.c16
3 files changed, 25 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 4de4f81..dc6aec2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -55,14 +55,21 @@ free lua memory at exit
Added @getent (FR issue #451)
+Fix when saving marks in file after importing xlsx file and saving it in sc format.
+
import mkd files
+The save format for :w command would be according to current file format. #493
+
Pending for v0.8.2 release
----------------------------
-+ modify :w to check current file name and save the file with the correct format.
+#pkg-config with libxlsxwriter doesnt seem to work well
+
++ modify savefile() from file.c to check current file format (applies to xlsx, ods, xlx formats)
+and save the file with the same format, rather than sc format.
+ Add to (or check the text in) doc file:
@getent
diff --git a/src/doc b/src/doc
index 449daf4..94fda42 100755
--- a/src/doc
+++ b/src/doc
@@ -392,6 +392,7 @@ Commands for handling cell content:
:w {file} Save the current spreadsheet as {file}.
:w! {file} Save the current spreadsheet as {file}, forcing an overwrite
if {file} already exists.
+ The format in which it will be save will be according to the current file extension, if any.
:h Show this help.
:help Show this help.
diff --git a/src/file.c b/src/file.c
index 4caf1b9..de180a7 100644
--- a/src/file.c
+++ b/src/file.c
@@ -308,6 +308,21 @@ int savefile() {
export_markdown(curfile, 0, 0, maxrow, maxcol);
modflg = 0;
return 0;
+
+ // treat xlsx format
+ } else if (strlen(curfile) > 5 && ( ! strcasecmp( & curfile[strlen(curfile)-5], ".xlsx") ||
+ ! strcasecmp( & curfile[strlen(curfile)-5], ".xlsx"))){
+#ifndef XLSX_EXPORT
+ sc_error("XLSX export support not compiled in. Please save file in other extension.");
+ return -1;
+#else
+ if (export_xlsx(curfile, 0, 0, maxrow, maxcol) == 0) {
+ sc_info("File \"%s\" written", curfile);
+ modflg = 0;
+ } else
+ sc_error("File could not be saved");
+ return 0;
+#endif
}
// save in sc format
@@ -315,6 +330,7 @@ int savefile() {
sc_error("File could not be saved");
return -1;
}
+ modflg = 0;
return 0;
}