From bdef566f2e28062576ead599eb0babbdcef879e5 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 11 Apr 2013 11:20:30 -0700 Subject: [PATCH] Fix Excel export of date columns Summary: In D4567, I made column formatting more strict, but possibly too strict. @anjali reports date columns showing internal Excel date formats ("42391.2292", etc). @jack, if you have a chance, can you apply this and verify the behavior with @anjali? Repro steps should be: - View any tasks in Maniphest. - Click "Export to Excel". - Open document in Excel. - Date column should show dates, not integers around 42,000. Otherwise I'll test this locally, I just need to rebuild some dependencies first which is a bit involved. Test Plan: None yet. Reviewers: jack, btrahan Reviewed By: btrahan CC: anjali, aran Differential Revision: https://secure.phabricator.com/D5467 --- .../maniphest/controller/ManiphestExportController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/applications/maniphest/controller/ManiphestExportController.php b/src/applications/maniphest/controller/ManiphestExportController.php index 1fc4988850..89b6ac05af 100644 --- a/src/applications/maniphest/controller/ManiphestExportController.php +++ b/src/applications/maniphest/controller/ManiphestExportController.php @@ -181,9 +181,8 @@ final class ManiphestExportController extends ManiphestController { foreach ($rows as $row => $cols) { foreach ($cols as $col => $spec) { $cell_name = $this->col($col).($row + 1); - $sheet - ->setCellValue($cell_name, $spec, $return_cell = true) - ->setDataType(PHPExcel_Cell_DataType::TYPE_STRING); + $cell = $sheet + ->setCellValue($cell_name, $spec, $return_cell = true); if ($row == 0) { $sheet->getStyle($cell_name)->applyFromArray($header_format); @@ -195,6 +194,8 @@ final class ManiphestExportController extends ManiphestController { ->getStyle($cell_name) ->getNumberFormat() ->setFormatCode($code); + } else { + $cell->setDataType(PHPExcel_Cell_DataType::TYPE_STRING); } } }