Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
brechtsanders committed Oct 24, 2016
1 parent 331c123 commit 0aee4c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
2016-10-24 Brecht Sanders https://github.com/brechtsanders/

* skip issue where "(null)" is written if cell data is NULL
* limit sheet name to 31 characters

0.2.7

Expand Down
7 changes: 6 additions & 1 deletion lib/xlsxio_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ DLL_EXPORT_XLSXIO const char* xlsxiowrite_get_version_string ()
#define XML_FILENAME_XL_WORKBOOK "workbook.xml"
#define XML_FILENAME_XL_STYLES "styles.xml"
#define XML_FILENAME_XL_WORKSHEET1 "sheet1.xml"
#define XML_SHEETNAME_MAXLEN 31

const char* content_types_xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n"
Expand Down Expand Up @@ -397,7 +398,11 @@ void* thread_proc (void* arg)
char* sheetname = NULL;
if (handle->sheetname) {
sheetname = strdup(handle->sheetname);
fix_xml_special_chars(&sheetname);
if (sheetname) {
if (strlen(sheetname) > XML_SHEETNAME_MAXLEN)
sheetname[XML_SHEETNAME_MAXLEN] = 0;
fix_xml_special_chars(&sheetname);
}
}
zip_add_dynamic_content_string(handle->zip, XML_FOLDER_XL XML_FILENAME_XL_WORKBOOK, workbook_xml, (sheetname ? sheetname : "Sheet1"));
free(sheetname);
Expand Down

0 comments on commit 0aee4c4

Please sign in to comment.