Re: [请益] phpexcel套表问题

楼主: xdraculax (首席怪叔叔)   2016-01-30 11:53:05
贴上格式
$sheet->duplicateStyle($style,$cell);
只能贴上单一个格式,不能像 Excel 贴上一个区块
一般的有标题表格范例
$rows = array(
array(1, '张三', 63750, '1960-08-24'),
array(2, '李四', 42100, '1989-12-07'),
array(3, '王五', -500, '2003-06-13')
);
$sheet->fromArray($rows,NULL,'A2',TRUE);
$y_end = count($rows)+1;
$x_end = count($rows[0]);
for($x=1; $x <= $x_end; $x++){
// 栏数字转文字, 如 0 → A, 1 → B
$col = PHPExcel_Cell::stringFromColumnIndex($x - 1);
$style = $sheet->getStyle("{$col}2");
// 整栏贴上格式
$sheet->duplicateStyle($style, "{$col}3:{$col}{$y_end}");
}
自己改成你的需求吧,应该要一格一格贴了
作者: joedenkidd (优质的蓝色射手)   2016-01-30 12:21:00
感谢...了解了

Links booklink

Contact Us: admin [ a t ] ucptt.com