From a23ef534e78ff4112469bc9f883f5de1aacfd83e Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 18 Jun 2020 11:07:44 +0800 Subject: [PATCH] configurable xlsx formating - --- GnumericToExcel.php | 10 +++++++--- Pman.Gnumeric.js | 9 ++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/GnumericToExcel.php b/GnumericToExcel.php index 527e1034..a14633e7 100644 --- a/GnumericToExcel.php +++ b/GnumericToExcel.php @@ -69,7 +69,10 @@ class Pman_Core_GnumericToExcel extends Pman $ext = '.xls'; $outfmt = 'Gnumeric_Excel:excel_biff8'; $mime = 'application/vnd.ms-excel'; - /* if (!empty($_POST['format']) && $_POST['format']=='xlsx') { + + /* + // ssconvert results in bad images + if (!empty($_POST['format']) && $_POST['format']=='xlsx') { $outfmt = 'Gnumeric_Excel:xlsx'; $ext = 'xlsx'; $mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; @@ -104,13 +107,14 @@ class Pman_Core_GnumericToExcel extends Pman header("HTTP/1.0 400 Internal Server Error - Convert error"); die("ERROR CONVERTING?:" . $cmd ."\n

OUTPUT:". htmlspecialchars($out)); } + if (!empty($_POST['format']) && $_POST['format']=='xlsx') { require_once 'File/Convert.php'; $cc = new File_Convert($targetTmp,'application/vnd.ms-excel'); $targetTmp = $cc->convert('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - $mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; - $ext = ".xlsx"; + $mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + $ext = "xlsx"; } diff --git a/Pman.Gnumeric.js b/Pman.Gnumeric.js index eb0675b5..d5819161 100644 --- a/Pman.Gnumeric.js +++ b/Pman.Gnumeric.js @@ -148,6 +148,13 @@ Roo.extend(Pman.Gnumeric, Roo.util.Observable, { rowOffset : 0, + /** + * @type {String} format - either XLSX (if images are used) or XLS - as ssconvert does not do images that well. + */ + + format : 'xlsx', + + /** * load: * run the connection, parse document and fire load event.. @@ -1715,7 +1722,7 @@ Roo.extend(Pman.Gnumeric, Roo.util.Observable, { timeout : 120000, // quite a long wait.. 2 minutes. params : { xml : ser.serializeToString(this.doc), - format : 'xlsx', //xml + format : this.format, debug : 0 }, -- 2.39.2