I am using PHPExcel to export data from my database to an excel file. So far it works perfectly. My problem is that I have a string value that I want to be separated in newline but must be contained in 1 cell. How can I do this? I have successfully exported it but the data in that cell is only occupying a single line.
Can anyone help me with this? Thank you in advance.
foreach ($documents as $document){
$excel->getActiveSheet()->setCellValueByColumnAndRow(0,$row,$document->getSubject());
$excel->getActiveSheet()->setCellValueByColumnAndRow(1,$row,$document->getDescription());
$excel->getActiveSheet()->setCellValueByColumnAndRow(2,$row,$document->getFrom());
$excel->getActiveSheet()->setCellValueByColumnAndRow(3,$row,$document->getDateReceived());
$excel->getActiveSheet()->setCellValueByColumnAndRow(4,$row,$document->getDueRD());
$excel->getActiveSheet()->setCellValueByColumnAndRow(5,$row,$document->getDueDate());
$excel->getActiveSheet()->setCellValueByColumnAndRow(6,$row,$document->getDue15Days());
$excel->getActiveSheet()->setCellValueByColumnAndRow(7,$row,$document->getChat());
$row++;
}
The last row $document->getChat() is a string containing newline character "\n".
Example: "Name: message \n Name2: message \n Name: message"
Aucun commentaire:
Enregistrer un commentaire