Better handling for new LibreOffice cell attributes to handle numbers as float

This commit is contained in:
Nathan Gray 2014-03-17 17:51:11 +00:00
parent df08e0a4a4
commit cd90487595

View File

@ -1083,8 +1083,8 @@ abstract class bo_merge
switch($mimetype)
{
case 'application/vnd.oasis.opendocument.spreadsheet': // open office calc
$format = '/<table:table-cell([^>]+?)office:value-type="[^"]+"([^>]*?)>.?<([a-z].*?)[^>]*>('.implode('|',$names).')<\/\3>.?<\/table:table-cell>/s';
$replacement = '<table:table-cell$1office:value-type="float" office:value="$4"$2>$4</table:table-cell>';
$format = '/<table:table-cell([^>]+?)office:value-type="[^"]+"([^>]*?)(?:calcext:value-type="[^"]+")?>.?<([a-z].*?)[^>]*>('.implode('|',$names).')<\/\3>.?<\/table:table-cell>/s';
$replacement = '<table:table-cell$1office:value-type="float" office:value="$4"$2 calcext:value-type="float"><$3>$4</$3></table:table-cell>';
break;
case 'application/vnd.oasis.opendocument.text': // tables in open office writer
$format = '/<table:table-cell([^>]+?)office:value-type="[^"]+"([^>]*?)>.?<([a-z].*?)[^>]*>('.implode('|',$names).')<\/\3>.?<\/table:table-cell>/s';
@ -1192,8 +1192,8 @@ abstract class bo_merge
switch($mimetype)
{
case 'application/vnd.oasis.opendocument.spreadsheet': // open office calc
$format = '/<table:table-cell([^>]+?)office:value-type="[^"]+"([^>]*?)>.?<([a-z].*?)[^>]*>\$\$('.implode('|',$names).')\$\$<\/\3>.?<\/table:table-cell>/s';
$replacement = '<table:table-cell$1office:value-type="date" office:date-value="\$\$$4\$\$"$2><$3>\$\$$4\$\$</$3></table:table-cell>';
$format = '/<table:table-cell([^>]+?)office:value-type="[^"]+"([^>]*?)(?:calcext:value-type="[^"]+")?>.?<([a-z].*?)[^>]*>\$\$('.implode('|',$names).')\$\$<\/\3>.?<\/table:table-cell>/s';
$replacement = '<table:table-cell$1office:value-type="date" office:date-value="\$\$$4\$\$"$2 calcext:value-type="date"><$3>\$\$$4\$\$</$3></table:table-cell>';
break;
case 'application/xmlExcel.Sheet': // Excel 2003
$format = '/'.preg_quote('<Data ss:Type="String">','/').'..('.implode('|',$names).')..'.preg_quote('</Data>','/').'/';