summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-03-27 23:42:18 -0300
committerAndrés <andmarti@gmail.com>2021-03-27 23:42:18 -0300
commit1d1909dbcac45cbce7031def17d4f28e56843fd9 (patch)
treeef976918dde5ee0c913c26f6a3371f6fd51020f8 /src
parent38ad38763c2ca5181dc1f9501b7de42c1e41ea29 (diff)
fixed macros for ODS
Diffstat (limited to 'src')
-rw-r--r--src/file.c2
-rw-r--r--src/ods.c20
2 files changed, 6 insertions, 16 deletions
diff --git a/src/file.c b/src/file.c
index 2bcd098..a17a90c 100644
--- a/src/file.c
+++ b/src/file.c
@@ -731,7 +731,7 @@ sc_readfile_result readfile(char * fname, int eraseflg) {
return SC_READFILE_SUCCESS;
// If file is an ODS file, we import it
- } else if (len > 5 && ! strcasecmp( & fname[len-4], ".ods")){
+ } else if (len > 4 && ! strcasecmp( & fname[len-4], ".ods")){
#ifndef ODS
sc_error("ODS import support not compiled in");
#else
diff --git a/src/ods.c b/src/ods.c
index ec938f9..888524d 100644
--- a/src/ods.c
+++ b/src/ods.c
@@ -39,7 +39,7 @@
* \file xlsx.c
* \author Andrés Martinelli <andmarti@gmail.com>
* \date 2021-03-27
- * \brief TODO Write a brief file description.
+ * \brief file that contains the functions to support ods file import
*
* \details ods import requires:
* - libzip-dev
@@ -54,8 +54,8 @@
#include "sc.h"
#include "utils/string.h"
#include <libxml/parser.h>
-//#include <libxml/tree.h>
#endif
+
/**
* \brief TODO Document open_ods()
*
@@ -66,6 +66,7 @@
*/
int open_ods(char * fname, char * encoding) {
+#ifdef ODS
struct zip * za;
struct zip_file * zf;
struct zip_stat sb_content;
@@ -134,7 +135,6 @@ int open_ods(char * fname, char * encoding) {
char * strf;
// here traverse table content
- //while (cur_node != NULL && strcmp((char *) cur_node->name, "table-row")) cur_node = cur_node->next; // forward until reach table
while (cur_node != NULL) {
if (! strcmp((char *) cur_node->name, "table-row")) {
// we are inside a table-row
@@ -172,8 +172,7 @@ int open_ods(char * fname, char * encoding) {
strf = str_replace (formula, "]","");
strcpy(formula, strf);
free(strf);
- // we take some excel common function and adds a @ to them
- // we replace count sum avg with @count, @sum, @prod, @avg, @min, @max
+ // we take some common function and adds a @ to them
strf = str_replace (formula, "COUNT","@COUNT");
strcpy(formula, strf);
free(strf);
@@ -223,15 +222,6 @@ int open_ods(char * fname, char * encoding) {
}
int_deleterow(currow, 1); /* delete the first row */
-
- //char * style = NULL;
- //char * style = (char *) xmlGetProp(child_node, (xmlChar *) "s"); // style
-
-
-
-
-
-
// free the document
xmlFreeDoc(doc);
@@ -245,6 +235,6 @@ int open_ods(char * fname, char * encoding) {
sc_error("cannot close zip archive `%s'", fname);
return -1;
}
-
+#endif
return 0;
}