1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

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
This commit is contained in:
epriestley 2013-04-11 11:20:30 -07:00
parent 7899068cec
commit bdef566f2e

View file

@ -181,9 +181,8 @@ final class ManiphestExportController extends ManiphestController {
foreach ($rows as $row => $cols) { foreach ($rows as $row => $cols) {
foreach ($cols as $col => $spec) { foreach ($cols as $col => $spec) {
$cell_name = $this->col($col).($row + 1); $cell_name = $this->col($col).($row + 1);
$sheet $cell = $sheet
->setCellValue($cell_name, $spec, $return_cell = true) ->setCellValue($cell_name, $spec, $return_cell = true);
->setDataType(PHPExcel_Cell_DataType::TYPE_STRING);
if ($row == 0) { if ($row == 0) {
$sheet->getStyle($cell_name)->applyFromArray($header_format); $sheet->getStyle($cell_name)->applyFromArray($header_format);
@ -195,6 +194,8 @@ final class ManiphestExportController extends ManiphestController {
->getStyle($cell_name) ->getStyle($cell_name)
->getNumberFormat() ->getNumberFormat()
->setFormatCode($code); ->setFormatCode($code);
} else {
$cell->setDataType(PHPExcel_Cell_DataType::TYPE_STRING);
} }
} }
} }