From 8a8de2bcc3cee077a24074f022c3742fadfb37a3 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Wed, 17 Jul 2013 17:12:52 +0000 Subject: [PATCH] Export the content of the CaseLogs in "spreadsheet" format, with some tricks to preserve the formatting in Excel. SVN:2.0.1[2805] --- application/cmdbabstract.class.inc.php | 7 +++++++ webservices/export.php | 1 + 2 files changed, 8 insertions(+) diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index bbb0f2472..fc7d35504 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -1219,6 +1219,13 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay $aRow[] = ''.date('H:i:s', $iDate).''; } } + else if($oAttDef instanceof AttributeCaseLog) + { + $rawValue = $oObj->Get($sAttCodeEx); + $outputValue = str_replace("\n", "
", htmlentities($rawValue->__toString(), ENT_QUOTES, 'UTF-8')); + // Trick for Excel: treat the content as text even if it begins with an equal sign + $aRow[] = ''.$outputValue.''; + } else { $rawValue = $oObj->Get($sAttCodeEx); diff --git a/webservices/export.php b/webservices/export.php index 14faa9bd5..5ca52e41c 100644 --- a/webservices/export.php +++ b/webservices/export.php @@ -237,6 +237,7 @@ if (!empty($sExpression)) header("Cache-control:", true); $sFields = implode(',', $aFields); + $oP->add_style('table br {mso-data-placement:same-cell;}'); // Trick for Excel: keep line breaks inside the same cell ! cmdbAbstractObject::DisplaySetAsHTMLSpreadsheet($oP, $oSet, array('fields' => $sFields, 'fields_advanced' => $bFieldsAdvanced, 'localize_values' => $bLocalize)); break;