[gnumeric] ssconvert: add an option to resize.



commit 350c4ca7c637b8d69191d717589c68ee3f052389
Author: Morten Welinder <terra gnome org>
Date:   Mon Feb 17 13:37:03 2014 -0500

    ssconvert: add an option to resize.

 ChangeLog       |    4 ++++
 src/ssconvert.c |   30 ++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cc62a88..0cd0429 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-02-17  Morten Welinder  <terra gnome org>
+
+       * src/ssconvert.c (convert): Add --resize options.
+
 2014-02-16  Jean Brefort  <jean brefort normalesup org>
 
        * src/item-grid.c (item_grid_realize): fix persistence of hyperlink tips.
diff --git a/src/ssconvert.c b/src/ssconvert.c
index 7294d03..0a0435a 100644
--- a/src/ssconvert.c
+++ b/src/ssconvert.c
@@ -46,6 +46,7 @@ static gboolean ssconvert_list_importers = FALSE;
 static gboolean ssconvert_one_file_per_sheet = FALSE;
 static gboolean ssconvert_recalc = FALSE;
 static gboolean ssconvert_solve = FALSE;
+static char *ssconvert_resize = NULL;
 static char *ssconvert_range = NULL;
 static char *ssconvert_import_encoding = NULL;
 static char *ssconvert_import_id = NULL;
@@ -130,6 +131,13 @@ static const GOptionEntry ssconvert_options [] = {
                NULL
        },
 
+       {
+               "resize", 0,
+               G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &ssconvert_resize,
+               N_("Resize to given ROWSxCOLS"),
+               NULL
+       },
+
 
        /* ---------------------------------------- */
 
@@ -745,6 +753,28 @@ convert (char const *inarg, char const *outarg, char const *mergeargs[],
                               wbv);
        }
 
+       if (ssconvert_resize) {
+               int rows, cols;
+               if (sscanf (ssconvert_resize, "%dx%d", &rows, &cols) == 2) {
+                       int n;
+
+                       g_printerr ("Resizing to %dx%d\n", rows, cols);
+                       for (n = workbook_sheet_count (wb) - 1;
+                            n >= 0;
+                            n--) {
+                               gboolean err;
+                               Sheet *sheet = workbook_sheet_by_index (wb, n);
+                               GOUndo *undo =
+                                       gnm_sheet_resize (sheet, cols, rows,
+                                                         NULL, &err);
+                               if (err)
+                                       g_printerr ("Resizing of sheet %s failed\n",
+                                                   sheet->name_unquoted);
+                               g_object_unref (undo);
+                       }
+               }
+       }
+
        if (ssconvert_recalc)
                workbook_recalc_all (wb);
        gnm_app_recalc ();


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