X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=GnumericToExcel.php;fp=GnumericToExcel.php;h=244ed1f3e9c28c4ff85ea535180237fd9f2574ed;hp=d4188412e06d492d7a24bd38e33c866a2319ff74;hb=4a20166941de485eb5c4584ce7fe02752a7782db;hpb=cfbfac37ce47a88072c658217053e2845f1d3493 diff --git a/GnumericToExcel.php b/GnumericToExcel.php index d4188412..244ed1f3 100644 --- a/GnumericToExcel.php +++ b/GnumericToExcel.php @@ -69,16 +69,17 @@ 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') { + /* if (!empty($_POST['format']) && $_POST['format']=='xlsx') { $outfmt = 'Gnumeric_Excel:xlsx'; $ext = 'xlsx'; - $mime = 'aapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + $mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; } + */ - $srcTmp = ini_get('session.save_path') . '/' .uniqid('gnumeric_').'.gnumeric'; - $targetTmp = ini_get('session.save_path') . '/' .uniqid('gnumeric_') . '.' . $ext; + $srcTmp = $this->tempName('gnumeric'); + $targetTmp = $this->tempName($ext); // write the gnumeric file... $fh = fopen($srcTmp,'w'); fwrite($fh, $xml); @@ -103,6 +104,16 @@ 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') { + $cc = new File_Convert($targetTmp,'application/vnd.ms-excel'); + $targetTmp = $cc->convert('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); + } + + + + + + // unlink($srcTmp); if (empty($fname)) { $fname = basename($targetTmp);