我提到了这个问题 How to set auto-line break PhpExcel?
但我不太清楚。所以这就是问题。
我从$content
如果我直接执行$objPHPExcel->getActiveSheet()->setCellValue('A9', $content);
我没有换行,
我只是想像05featureddemo.inc.php中的确切方式那样做
它说$objPHPExcel->getActiveSheet()->setCellValue('A3', $sLloremIpsum);
但是我无法找到所给出的coloumn的大小,即
我问,因为即使我从下面的数组中删除了样式
$objPHPExcel->getActiveSheet()->getStyle('A3:E3')->applyFromArray(
array(
'font' => array(
'bold' => true
),
'alignment' => array(
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
),
'borders' => array(
'top' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN
)
),
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR,
'rotation' => 90,
'startcolor' => array(
'argb' => 'FFA0A0A0'
),
'endcolor' => array(
'argb' => 'FFFFFFFF'
)
)
)
);
$objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray(
array(
'alignment' => array(
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
),
'borders' => array(
'left' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN
)
)
)
);
并将其设为
$objPHPExcel->getActiveSheet()->getStyle('A3:E3')->applyFromArray(
array(
)
);
$objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray(
array(
)
);
有效,
所以问题是如何设置特定coloumn和coloumn组的换行符为20px说)
答案 0 :(得分:4)
完全取自05featureddemo.inc.php
:
// Set the cell (or group of cells) to enable text wrap in those cells
$objPHPExcel->getActiveSheet()
->getStyle('A3:A6')
->getAlignment()
->setWrapText(true);
// Set the column to a fixed width
$objPHPExcel->getActiveSheet()
->getColumnDimension('A')
->setWidth(80);