how to make New lines in a cell using phpexcel

后端 未结 5 519
故里飘歌
故里飘歌 2020-12-08 09:32

i have problem with php excel,

i want to make new line in one cell but i can\'t, i have tried using \\n or
but itsn\'t work. this my code:

<         


        
5条回答
  •  北荒
    北荒 (楼主)
    2020-12-08 09:42

    Improved answer based on Ravin and others

    $objPHPExcel
      ->getActiveSheet()
      ->setCellValue('H5', "Hello".PHP_EOL." World");
    
    $objPHPExcel
      ->getActiveSheet()
      ->getStyle('H5')
      ->getAlignment()
      ->setWrapText(true);
    

提交回复
热议问题