added support for ms excel 2007

This commit is contained in:
Ralf Becker 2009-09-01 14:41:48 +00:00
parent 4a2d859391
commit 4e2f35d4dc
3 changed files with 16 additions and 2 deletions

View File

@ -87,8 +87,10 @@ abstract class bo_merge
case 'application/vnd.oasis.opendocument.spreadsheet': // oo spreadsheet case 'application/vnd.oasis.opendocument.spreadsheet': // oo spreadsheet
if (!$zip_available) break; if (!$zip_available) break;
return true; // open office write xml files return true; // open office write xml files
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms word 2007 xml format
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.d': // mimetypes in vfs are limited to 64 chars case 'application/vnd.openxmlformats-officedocument.wordprocessingml.d': // mimetypes in vfs are limited to 64 chars
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': // ms excel 2007 xml format
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.shee':
if (!$zip_available) break; if (!$zip_available) break;
return true; // ms word xml format return true; // ms word xml format
default: default:
@ -315,7 +317,7 @@ abstract class bo_merge
// remove not existing replacements (eg. from calendar array) // remove not existing replacements (eg. from calendar array)
if (strpos($content,'$$') !== null) if (strpos($content,'$$') !== null)
{ {
$content = preg_replace('/\$\$[a-z0-9_]+\$\$/i','',$content); $content = preg_replace('/\$\$[a-z0-9_\/]+\$\$/i','',$content);
} }
if ($contentrepeat) $contentrep[$id] = $content; if ($contentrepeat) $contentrep[$id] = $content;
} }
@ -350,6 +352,8 @@ abstract class bo_merge
break; break;
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.d': // mimetypes in vfs are limited to 64 chars case 'application/vnd.openxmlformats-officedocument.wordprocessingml.d': // mimetypes in vfs are limited to 64 chars
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.shee':
// todo ms word xml files // todo ms word xml files
break; break;
} }
@ -372,6 +376,8 @@ abstract class bo_merge
break; break;
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.d': // mimetypes in vfs are limited to 64 chars case 'application/vnd.openxmlformats-officedocument.wordprocessingml.d': // mimetypes in vfs are limited to 64 chars
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.shee':
// todo ms word xml files // todo ms word xml files
break; break;
} }
@ -429,6 +435,13 @@ abstract class bo_merge
'([a-z]{2}-[A-Z]{2})'.preg_quote('"/></w:rPr><w:t>$$','/').'/i' => '$$\\2$$', '([a-z]{2}-[A-Z]{2})'.preg_quote('"/></w:rPr><w:t>$$','/').'/i' => '$$\\2$$',
); );
break; break;
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.shee':
$mime_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
$archive = tempnam($GLOBALS['egw_info']['server']['temp_dir'], basename($document,'.xlsx').'-').'.xlsx';
copy($content_url,$archive);
$content_url = 'zip://'.$archive.'#'.($content_file = 'xl/sharedStrings.xml');
break;
} }
if (!($merged =& $this->merge($content_url,$ids,$err,$mime_type,$fix))) if (!($merged =& $this->merge($content_url,$ids,$err,$mime_type,$fix)))
{ {

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

View File

@ -415,6 +415,7 @@ class mime_magic
'xht' => 'application/xhtml+xml', 'xht' => 'application/xhtml+xml',
'xhtml' => 'application/xhtml+xml', 'xhtml' => 'application/xhtml+xml',
'xls' => 'application/vnd.ms-excel', 'xls' => 'application/vnd.ms-excel',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', // excel xml format
'xlt' => 'application/vnd.ms-excel', 'xlt' => 'application/vnd.ms-excel',
'xml' => 'application/xml', 'xml' => 'application/xml',
'xpm' => 'image/x-xpixmap', 'xpm' => 'image/x-xpixmap',