ext/xlsxwriter/libxlsxwriter/src/shared_strings.c in xlsxwriter-0.0.5 vs ext/xlsxwriter/libxlsxwriter/src/shared_strings.c in xlsxwriter-0.0.6

- old
+ new

@@ -160,10 +160,19 @@ if (escaped_string) free(string); } /* + * Write the <si> element for rich strings. + */ +STATIC void +_write_rich_si(lxw_sst *self, char *string) +{ + lxw_xml_rich_si_element(self->file, string); +} + +/* * Write the <sst> element. */ STATIC void _write_sst(lxw_sst *self) { @@ -196,11 +205,15 @@ { struct sst_element *sst_element; STAILQ_FOREACH(sst_element, self->order_list, sst_order_pointers) { /* Write the si element. */ - _write_si(self, sst_element->string); + if (sst_element->is_rich_string) + _write_rich_si(self, sst_element->string); + else + _write_si(self, sst_element->string); + } } /* * Assemble and write the XML file. @@ -228,11 +241,11 @@ ****************************************************************************/ /* * Add to or find a string in the SST SharedString table and return it's index. */ struct sst_element * -lxw_get_sst_index(lxw_sst *sst, const char *string) +lxw_get_sst_index(lxw_sst *sst, const char *string, uint8_t is_rich_string) { struct sst_element *element; struct sst_element *existing_element; /* Create an sst element to potentially add to the table. */ @@ -241,9 +254,10 @@ return NULL; /* Create potential new element with the string and its index. */ element->index = sst->unique_count; element->string = lxw_strdup(string); + element->is_rich_string = is_rich_string; /* Try to insert it and see whether we already have that string. */ existing_element = RB_INSERT(sst_rb_tree, sst->rb_tree, element); /* If existing_element is not NULL, then it already existed. */