我正在使用PHPExcel创建一个xls文件。我合并了单元格(B2:E2),但我希望在B2中输入的文本仅在B2单元格中水平对齐。它在合并的单元格中居中对齐。
$sheet_obj->getStyle('B2')->getAlignment()->setHorizontal(
PHPExcel_Style_Alignment::HORIZONTAL_CENTER
);
答案 0 :(得分:1)
希望这会有所帮助
public function saveAdditionalDataForRecord($header, $data, $record)
{
$em = $this->getEntityManager();
foreach ($header as $key => $value) {
$clientRecordAdditionalData = new ClientRecordAdditionalData();
$clientRecordAdditionalData->setName($value);
$clientRecordAdditionalData->setValue($data[$key]);
$clientRecordAdditionalData->setRecord($record);
$em->persist($clientRecordAdditionalData);
}
$em->flush();
return $clientRecordAdditionalData->getId();
}