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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user