configurable xlsx formating -
authorAlan Knowles <alan@roojs.com>
Thu, 18 Jun 2020 03:07:44 +0000 (11:07 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 18 Jun 2020 03:07:44 +0000 (11:07 +0800)
GnumericToExcel.php
Pman.Gnumeric.js

index 527e103..a14633e 100644 (file)
@@ -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<BR><BR> 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";
          }
         
         
index eb0675b..d581916 100644 (file)
@@ -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
                
             },