[gnumeric] Kspread needs the formats implied by Excel



commit 3503f22154b9f6c78062a1354875e23c0ed5e261
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sat Jun 25 22:36:55 2011 -0600

     Kspread needs the formats implied by Excel
    
    2011-06-25  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* xlsx-write-docprops.c (xlsx_write_docprops_custom):
    	enable
    	* xlsx-write.c (ns_docprops_custom): new
    	(xlsx_write_fills): Kspread needs the formats implied by
    	Excel

 plugins/excel/ChangeLog             |    8 +++
 plugins/excel/xlsx-write-docprops.c |    4 +-
 plugins/excel/xlsx-write.c          |   92 +++++++++++++++++------------------
 3 files changed, 54 insertions(+), 50 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 565886a..e7f0033 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,13 @@
 2011-06-25  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* xlsx-write-docprops.c (xlsx_write_docprops_custom):
+	enable
+	* xlsx-write.c (ns_docprops_custom): new
+	(xlsx_write_fills): Kspread needs the formats implied by
+	Excel
+
+2011-06-25  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* xlsx-write-docprops.c (xlsx_write_docprops_app): The
 	AppVersion format should really be d.dddd.
 
diff --git a/plugins/excel/xlsx-write-docprops.c b/plugins/excel/xlsx-write-docprops.c
index 1cdb97a..d801bca 100644
--- a/plugins/excel/xlsx-write-docprops.c
+++ b/plugins/excel/xlsx-write-docprops.c
@@ -300,14 +300,13 @@ xlsx_write_docprops_core (XLSXWriteState *state, GsfOutfile *root_part, GsfOutfi
 static void
 xlsx_write_docprops_custom (XLSXWriteState *state, GsfOutfile *root_part, GsfOutfile *docprops_dir)
 {
-#if 0
 	GsfOutput *part = gsf_outfile_open_pkg_add_rel 
 		(docprops_dir, "custom.xml",
 		 "application/vnd.openxmlformats-officedocument.custom-properties+xml",
 		 root_part,
 		 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties";);
 	GsfXMLOut *xml = gsf_xml_out_new (part);
-	GsfDocMetaData *meta = go_doc_get_meta_data (GO_DOC (state->base.wb));
+	/* GsfDocMetaData *meta = go_doc_get_meta_data (GO_DOC (state->base.wb)); */
 
 	gsf_xml_out_start_element (xml, "Properties");
 	gsf_xml_out_add_cstr_unchecked (xml, "xmlns", ns_docprops_custom);
@@ -320,7 +319,6 @@ xlsx_write_docprops_custom (XLSXWriteState *state, GsfOutfile *root_part, GsfOut
 	g_object_unref (xml);
 	gsf_output_close (part);
 	g_object_unref (part);
-#endif
 }
 
 static void
diff --git a/plugins/excel/xlsx-write.c b/plugins/excel/xlsx-write.c
index 752421d..03c48f5 100644
--- a/plugins/excel/xlsx-write.c
+++ b/plugins/excel/xlsx-write.c
@@ -84,7 +84,7 @@ static char const *ns_docprops_core_dcterms  = "http://purl.org/dc/terms/";;
 static char const *ns_docprops_core_xsi      = "http://www.w3.org/2001/XMLSchema-instance";;
 static char const *ns_docprops_extended      = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties";;
 static char const *ns_docprops_extended_vt   = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes";;
-/* static char const *ns_docprops_custom        = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties";; */
+static char const *ns_docprops_custom        = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties";;
 static char const *ns_drawing	 = "http://schemas.openxmlformats.org/drawingml/2006/main";;
 static char const *ns_chart	 = "http://schemas.openxmlformats.org/drawingml/2006/chart";;
 static char const *ns_rel	 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";;
@@ -553,58 +553,56 @@ xlsx_write_fills (XLSXWriteState *state, GsfXMLOut *xml)
 		}
 	}
 
-	if (styles_w_fills->len > 0) {
-		gsf_xml_out_start_element (xml, "fills");
-		gsf_xml_out_add_int (xml, "count", styles_w_fills->len 
-				     + N_PREDEFINED_FILLS);
-		/* Excel considers the first few fills special (not according to */
-		/* ECMA)                            */
-		xlsx_write_predefined_fills (xml);
-		for (i = 0 ; i < styles_w_fills->len ; i++) {
-			GnmStyle const *style = g_ptr_array_index (styles_w_fills, i);
-			gsf_xml_out_start_element (xml, "fill");
-			gsf_xml_out_start_element (xml, "patternFill");
-			if (gnm_style_is_element_set (style, MSTYLE_PATTERN)) {
-				gint pattern = gnm_style_get_pattern (style);
-				switch (pattern) {
-				case 0:
+	gsf_xml_out_start_element (xml, "fills");
+	gsf_xml_out_add_int (xml, "count", styles_w_fills->len 
+			     + N_PREDEFINED_FILLS);
+	/* Excel considers the first few fills special (not according to */
+	/* ECMA)                            */
+	xlsx_write_predefined_fills (xml);
+	for (i = 0 ; i < styles_w_fills->len ; i++) {
+		GnmStyle const *style = g_ptr_array_index (styles_w_fills, i);
+		gsf_xml_out_start_element (xml, "fill");
+		gsf_xml_out_start_element (xml, "patternFill");
+		if (gnm_style_is_element_set (style, MSTYLE_PATTERN)) {
+			gint pattern = gnm_style_get_pattern (style);
+			switch (pattern) {
+			case 0:
+				gsf_xml_out_add_cstr_unchecked (xml, "patternType", 
+								"none");
+				break;
+			case 1:
+				gsf_xml_out_add_cstr_unchecked (xml, "patternType", 
+								"solid");
+				if (gnm_style_is_element_set (style, MSTYLE_COLOR_BACK)) {
+					xlsx_write_color_element 
+						(xml, "fgColor", 
+						 gnm_style_get_back_color (style)->go_color);
+				}
+				break;
+			default:
+				if (pattern < 2 || pattern > (gint)G_N_ELEMENTS (pats)) 
 					gsf_xml_out_add_cstr_unchecked (xml, "patternType", 
 									"none");
-					break;
-				case 1:
+				else
 					gsf_xml_out_add_cstr_unchecked (xml, "patternType", 
-									"solid");
-					if (gnm_style_is_element_set (style, MSTYLE_COLOR_BACK)) {
-						xlsx_write_color_element 
-							(xml, "fgColor", 
-							 gnm_style_get_back_color (style)->go_color);
-					}
-					break;
-				default:
-					if (pattern < 2 || pattern > (gint)G_N_ELEMENTS (pats)) 
-						gsf_xml_out_add_cstr_unchecked (xml, "patternType", 
-										"none");
-					else
-						gsf_xml_out_add_cstr_unchecked (xml, "patternType", 
-										pats[pattern - 1]);
-					break;
-				}
-				if (pattern > 1) {
-					if (gnm_style_is_element_set (style, MSTYLE_COLOR_BACK))
-						xlsx_write_color_element 
-							(xml, "fgColor", 
-							 gnm_style_get_back_color (style)->go_color);
-					if (gnm_style_is_element_set (style, MSTYLE_COLOR_PATTERN))
-						xlsx_write_color_element 
-							(xml, "bgColor", 
-							 gnm_style_get_pattern_color (style)->go_color);
-				}
+									pats[pattern - 1]);
+				break;
+			}
+			if (pattern > 1) {
+				if (gnm_style_is_element_set (style, MSTYLE_COLOR_BACK))
+					xlsx_write_color_element 
+						(xml, "fgColor", 
+						 gnm_style_get_back_color (style)->go_color);
+				if (gnm_style_is_element_set (style, MSTYLE_COLOR_PATTERN))
+					xlsx_write_color_element 
+						(xml, "bgColor", 
+						 gnm_style_get_pattern_color (style)->go_color);
 			}
-			gsf_xml_out_end_element (xml);				
-			gsf_xml_out_end_element (xml);				
 		}
-		gsf_xml_out_end_element (xml);	
+		gsf_xml_out_end_element (xml);				
+		gsf_xml_out_end_element (xml);				
 	}
+	gsf_xml_out_end_element (xml);	
 	
 	g_ptr_array_free (styles_w_fills, TRUE);
 	return fills_hash;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]