PHPExcel format column to date format 14-Mar

前端 未结 1 371
执笔经年
执笔经年 2021-01-24 04:56

Is it possible to format a column (C2:C50) with PHPExcel with the following selected values:

\"Excel

相关标签:
1条回答
  • 2021-01-24 05:20

    PHPExcel only has a limited set of built-in constants for formats, but you can set the format code to any valid (custom) format just by using the appropriate string:

    $sheet->getStyle('C2:C50')
        ->getNumberFormat()
        ->setFormatCode('d-mmm');
    

    Note that locale-specific day/month names such as Woensdaag and Maart aren't supported by writers other than the MS Excel specific writers (ie. not in CSV, HTML, PDF)

    Most custom format strings will work, though there are a few obscure ones such as $#,," M" that aren't directly supported, for display in formats other than MS Excel itself

    0 讨论(0)
提交回复
热议问题