[gnumeric] write pageSetUpPr to xlsx



commit eecce2263963c7d1d27505fdf0831f8385d55d2a
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Jun 12 20:24:21 2013 -0600

    write pageSetUpPr to xlsx
    
    2013-06-12  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * xlsx-write.c (xlsx_write_print_info): always write fitTo*
        (xlsx_write_sheet): write pageSetUpPr

 plugins/excel/ChangeLog    |    5 +++++
 plugins/excel/xlsx-write.c |   32 ++++++++++++++++++--------------
 2 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index e019763..540b65e 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,10 @@
 2013-06-12  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * xlsx-write.c (xlsx_write_print_info): always write fitTo*
+       (xlsx_write_sheet): write pageSetUpPr
+
+2013-06-12  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * xlsx-read.c (xlsx_set_paper_from_code): update paper list
 
 2013-06-12  Andreas J. Guelzow <aguelzow pyrshep ca>
diff --git a/plugins/excel/xlsx-write.c b/plugins/excel/xlsx-write.c
index 38d0220..61d266c 100644
--- a/plugins/excel/xlsx-write.c
+++ b/plugins/excel/xlsx-write.c
@@ -2011,12 +2011,10 @@ xlsx_write_print_info (XLSXWriteState *state, GsfXMLOut *xml)
        }
        if (pi->start_page >= 0)
                gsf_xml_out_add_int (xml, "firstPageNumber", pi->start_page);
-       if (pi->scaling.type == PRINT_SCALE_FIT_PAGES) {
-               if (pi->scaling.dim.rows > 0)
-                       gsf_xml_out_add_int (xml, "fitToHeight", pi->scaling.dim.rows);
-               if (pi->scaling.dim.cols > 0)
-                       gsf_xml_out_add_int (xml, "fitToWidth", pi->scaling.dim.cols);
-       }
+       if (pi->scaling.dim.rows > 0)
+               gsf_xml_out_add_int (xml, "fitToHeight", pi->scaling.dim.rows);
+       if (pi->scaling.dim.cols > 0)
+               gsf_xml_out_add_int (xml, "fitToWidth", pi->scaling.dim.cols);
        /* horizontalDpi skipped */
        /* id skipped */
 
@@ -2062,7 +2060,7 @@ xlsx_write_print_info (XLSXWriteState *state, GsfXMLOut *xml)
                }
        }
 
-       if (pi->scaling.type == PRINT_SCALE_PERCENTAGE) 
+       if (pi->scaling.percentage.x > 0) 
                gsf_xml_out_add_int (xml, "scale", 
                                     (int)CLAMP (pi->scaling.percentage.x, 10, 400));
        xlsx_add_bool (xml, "useFirstPageNumber", (pi->start_page >= 0));
@@ -2256,6 +2254,7 @@ xlsx_write_sheet (XLSXWriteState *state, GsfOutfile *dir, GsfOutfile *wb_part, u
        GSList   *charts;
        char const *chart_drawing_rel_id = NULL;
        GnmStyle **col_styles;
+       PrintInformation *pi = NULL;
 
        state->sheet = workbook_sheet_by_index (state->base.wb, i);
        col_styles = sheet_style_most_common (state->sheet, TRUE);
@@ -2284,18 +2283,23 @@ xlsx_write_sheet (XLSXWriteState *state, GsfOutfile *dir, GsfOutfile *wb_part, u
        gsf_xml_out_add_cstr_unchecked (xml, "xmlns", ns_ss);
        gsf_xml_out_add_cstr_unchecked (xml, "xmlns:r", ns_rel);
 
-       /* for now we only use tabColor, move sheetPr outside when we add more
-        * features */
-       if (NULL != state->sheet->tab_color) {
-/*   element sheetPr { CT_SheetPr }?,     */
-               gsf_xml_out_start_element (xml, "sheetPr");
+       /*   element sheetPr { CT_SheetPr }?,     */
+       gsf_xml_out_start_element (xml, "sheetPr");
+       
+       pi = state->sheet->print_info;
+       if (pi != NULL) {
+               gsf_xml_out_start_element (xml, "pageSetUpPr");
+               xlsx_add_bool (xml, "fitToPage", pi->scaling.type == PRINT_SCALE_FIT_PAGES);
+               gsf_xml_out_end_element (xml); /* </pageSetUpPr> */
+       }
 
+       if (NULL != state->sheet->tab_color) {
                gsf_xml_out_start_element (xml, "tabColor");
                xlsx_add_rgb (xml, "rgb", state->sheet->tab_color->go_color);
                gsf_xml_out_end_element (xml); /* </tabColor> */
-
-               gsf_xml_out_end_element (xml); /* </sheetPr> */
        }
+       gsf_xml_out_end_element (xml); /* </sheetPr> */
+       
 /*   element dimension { CT_SheetDimension }?,     */
        gsf_xml_out_start_element (xml, "dimension");
        xlsx_add_range (xml, "ref", &extent);


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