php 导出 设置多表头,php 导出复杂表头excel表头格式错乱?

$Head = array(

array('value' => $year."年省直单位申购车辆申请呈批表",'col' => 19,'row' => 3,

'children' =>

array(

array('value' => $date,'col' => 4,'row' => 1,

'children' =>

array(

array('value' => '序号','col' => 1,'row' => 3),

array('value' => '单位','col' => 1,'row' => 3,'width' => 25),

array('value' => '机关有关情况','col' => 6,'row' => 1,

'children' =>

array(

array('value' => '规格','col' => 1,'row' => 2),

array('value' => '性质','col' => 1,'row' => 2),

array('value' => '经费供应渠道','col' => 1,'row' => 2,'width' => 25),

array('value' => '领导职数','col' => 1,'row' => 2,'width' => 25),

array('value' => '人员编制','col' => 1,'row' => 2,'width' => 25,),

array('value' => '离退休干部数','col' => 1,'row' => 2,'width' => 25)

)

),

array('value' => '现有车辆情况','col' => 3,'row' => 1,

'children' =>

array(

array('value' => '编制车数','col' => 1,'row' => 2,'width' => 25),

array('value' => '实有车数','col' => 1,'row' => 2,'width' => 25),

array('value' => '应报废车辆数','col' => 1,'row' => 2,'width' => 25)

)

),

array('value' => '申购车辆情况','col' => 7,'row' => 1,

'children' =>

array(

array('value' => '厂牌型号','col' => 1,'row' => 2,'width' => 25),

array('value' => '种类','col' => 1,'row' => 2),

array('value' => '排量或座位数','col' => 1,'row' => 2,'width' => 25),

array('value' => '数量','col' => 1,'row' => 2),

array('value' => '单价','col' => 1,'row' => 2),

array('value' => '经费合计','col' => 1,'row' => 2,'width' => 25),

array('value' => '经费来源','col' => 1,'row' => 2,'width' => 25)

)

),

array('value' => '备注','col' => 1,'row' => 3)

)

),

array('value' => '','col' => 13),

array('value' => '金额单位:万元','col' => 2),

)

)

);

$arr = array();

$data = array();

while ($row = sqlsrv_fetch_array($result,SQLSRV_FETCH_ASSOC)) {

$data['rownum'] = $row['rownum'];

$data['companyname'] = $row['companyname'];

$data['unitspec'] = $row['unitspec'];

$data['unitprop'] = $row['unitprop'];

$data['fundspychannels'] = $row['fundspychannels'];

$data['officepostnum'] = $row['officepostnum'];

$data['staffnum'] = $row['staffnum'];

$data['retirednum'] = $row['retirednum'];

$data['quotacar'] = $row['quotacar'];

$data['availcar'] = $row['availcar'];

$data['scrapcar'] = $row['scrapcar'];

$data['brand'] = $row['brand'];

$data['cartype'] = $row['cartype'];

$data['output'] = $row['output'];

$data['num'] = $row['num'];

$data['oneprice'] = $row['oneprice'];

$data['price'] = $row["num"]*$row["oneprice"];

$data['afundfrom'] = $row['afundfrom'];

$data['remark'] = $row['remark'];

array_push($arr,$data);

}

$phpExcelCore = new PHPExcelCore();

$fn = $phpExcelCore::RecursionCreateExecl($Head,$arr);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值