The problem I am facing is, I am not able to set cell value as text-overflow (not clipped or wrapped). It is always hiding with a red triangle sign in Libre Calc.
I have a sample .xls sheet that I need to replicate dynamically. I got successful in generating the same .xls sheet using PHPSpreadsheet library in Codeigniter framework.
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setTitle('1');
$sheet->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
$sheet->getPageSetup()->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
$query_date = $data['month_selected'].' '.$data['year_selected'];
$date = new DateTime($query_date);
$date->modify('first day of this month');
$firstday= $date->format('n/j/Y');
$date->modify('last day of this month');
$lastday= $date->format('n/j/Y');
$xrow = 1;
$sheet->setCellValue('A' . $xrow, 'Attedence for the Period Beginning From '.$firstday.' TO '.$lastday)->getStyle('I' . $xrow)->applyFromArray($borderArrayRowOther);
The Text in the cell always gets hide when I see it in office 365 and Libre Calc. I need to double click to show it fully. But I need it shows fully.
[overlapped text][1]: https://i.stack.imgur.com/zi3Pj.png
You have to use
$spreadsheet->getActiveSheet()->getStyle('A1')->getAlignment()->setWrapText(true);
For more Information see documentation .
According to this comit this comit this will be automaticly included in future releases.
Maybe you must/will use some autofit then take a look to this code .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.