I am using PHPExcel to create a xls file. I have merged the cells (B2:E2), but I want the text entered in B2 to be horizantally center aligned in the B2 cell only. It gets center aligned in the merged cell.
$sheet_obj->getStyle('B2')->getAlignment()->setHorizontal(
PHPExcel_Style_Alignment::HORIZONTAL_CENTER
);
希望这可以帮助
$sheet_obj->getActiveSheet()->getStyle('G2') ->getAlignment()->setHorizontal(\\PhpOffice\\PhpSpreadsheet\\Style\\Alignment::HORIZONTAL_CENTER);
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.