[gnumeric] In xlsx export also write styles for empty cells
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] In xlsx export also write styles for empty cells
- Date: Thu, 16 Jun 2011 05:28:14 +0000 (UTC)
commit 99653c30c4df6e1df9e5cb8af3bfd9b27bb7bb3b
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Wed Jun 15 23:27:00 2011 -0600
In xlsx export also write styles for empty cells
2011-06-15 Andreas J. Guelzow <aguelzow pyrshep ca>
* xlsx-write.c (xlsx_write_border): use edition 1 elements
(xlsx_write_cells): also write styles for empty cells
plugins/excel/ChangeLog | 5 +++++
plugins/excel/xlsx-write.c | 37 +++++++++++++++++++++++--------------
2 files changed, 28 insertions(+), 14 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 1596592..9681826 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,10 @@
2011-06-15 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * xlsx-write.c (xlsx_write_border): use edition 1 elements
+ (xlsx_write_cells): also write styles for empty cells
+
+2011-06-15 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* xlsx-write.c (xlsx_find_border): new
(xlsx_write_border): new
(xlsx_write_borders): implement
diff --git a/plugins/excel/xlsx-write.c b/plugins/excel/xlsx-write.c
index df101e2..16dbd25 100644
--- a/plugins/excel/xlsx-write.c
+++ b/plugins/excel/xlsx-write.c
@@ -590,11 +590,13 @@ xlsx_write_border (XLSXWriteState *state, GsfXMLOut *xml, GnmBorder *border, Gnm
gsf_xml_out_start_element (xml, "bottom");
break;
case MSTYLE_BORDER_LEFT:
- gsf_xml_out_start_element (xml, "start");
+ gsf_xml_out_start_element (xml, "left");
+ /* gsf_xml_out_start_element (xml, "start"); (ECMA 376 2nd edition) */
break;
default:
case MSTYLE_BORDER_RIGHT:
- gsf_xml_out_start_element (xml, "end");
+ gsf_xml_out_start_element (xml, "right");
+ /* gsf_xml_out_start_element (xml, "end"); (ECMA 376 2nd edition) */
break;
}
switch (border->line_type) {
@@ -1058,25 +1060,25 @@ xlsx_write_cells (XLSXWriteState *state, GsfXMLOut *xml, GnmRange const *extent)
}
for (c = extent->start.col ; c <= extent->end.col ; c++) {
+ GnmStyle const *style = sheet_style_get (state->sheet, c, r);
+ gint style_id = -1;
+ if (style != NULL) {
+ if (NULL == (tmp = g_hash_table_lookup (state->styles_hash, style))) {
+ g_ptr_array_add (state->styles_array, (gpointer) style);
+ tmp = GINT_TO_POINTER (state->styles_array->len);
+ g_hash_table_insert (state->styles_hash, (gpointer) style, tmp);
+ }
+ style_id = GPOINTER_TO_INT (tmp) - 1;
+ }
+
if (NULL != (cell = sheet_cell_get (state->sheet, c, r))) {
- GnmStyle const *style;
- gint style_id;
-
xlsx_write_init_row (&needs_row, xml, r, cheesy_span);
val = cell->value;
gsf_xml_out_start_element (xml, "c");
gsf_xml_out_add_cstr_unchecked (xml, "r",
cell_coord_name (c, r));
- style = sheet_style_get (state->sheet, c, r);
- if (style != NULL) {
- if (NULL == (tmp = g_hash_table_lookup (state->styles_hash, style))) {
- g_ptr_array_add (state->styles_array, (gpointer) style);
- tmp = GINT_TO_POINTER (state->styles_array->len);
- g_hash_table_insert (state->styles_hash, (gpointer) style, tmp);
- }
- style_id = GPOINTER_TO_INT (tmp) - 1;
+ if (style_id > -1)
gsf_xml_out_add_int (xml, "s", style_id);
- }
switch (val->type) {
default :
@@ -1142,6 +1144,13 @@ xlsx_write_cells (XLSXWriteState *state, GsfXMLOut *xml, GnmRange const *extent)
}
gsf_xml_out_end_element (xml); /* </c> */
+ } else if (style_id > -1) {
+ xlsx_write_init_row (&needs_row, xml, r, cheesy_span);
+ gsf_xml_out_start_element (xml, "c");
+ gsf_xml_out_add_cstr_unchecked (xml, "r",
+ cell_coord_name (c, r));
+ gsf_xml_out_add_int (xml, "s", style_id);
+ gsf_xml_out_end_element (xml); /* </c> */
}
}
if (!needs_row)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]