使合并列在导出phpexcell

时间:2019-07-08 03:46:56

标签: codeigniter-3

如何合并像这样的图片列?

![数据](https://1.bp.blogspot.com/-6ytrX0ro1As/XSK6w-DHezI/AAAAAAAAATA/kImKKmDV_Xw80lMUUekNL1sI3eNDeqlNACLcBGAs/s320/data.png

public function excel()
    {
        $this->load->helper('exportexcel');
        $namaFile = "export_data.xls";
        $button = "Export_My_Data";
        $tablehead = 0;
        $tablebody = 1;
        $no = 1;

        header("Pragma: public");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
        header("Content-Type: application/force-download");
        header("Content-Type: application/octet-stream");
        header("Content-Type: application/download");
        header("Content-Disposition: attachment;filename=" . $namaFile . "");
        header("Content-Transfer-Encoding: binary ");

        xlsBOF();

        $kolomhead = 0;
        xlsWriteLabel($tablehead, $kolomhead++, "No");
    xlsWriteLabel($tablehead, $kolomhead++, "Data A");
    xlsWriteLabel($tablehead, $kolomhead++, "Date");
    xlsWriteLabel($tablehead, $kolomhead++, "Date 1");
    xlsWriteLabel($tablehead, $kolomhead++, "Date 2");

     foreach ($this->data_model->get_all() as $data) {
            $kolombody = 0;

     xlsWriteNumber($tablebody, $kolombody++, $no);
     xlsWriteNumber($tablebody, $kolombody++, $data->data_a);
     xlsWriteNumber($tablebody, $kolombody++, $data->date_1);
     xlsWriteNumber($tablebody, $kolombody++, $data->date_2);
     $tablebody++;
            $no++;
        }
        xlsEOF();
        exit();
    }

这可行,但是我想像上表一样显示它,如果有人可以帮助我,我感到非常高兴?

0 个答案:

没有答案