如何将二维数组打印到phpexcel中

时间:2014-06-27 12:19:12

标签: phpexcel

    Array
    (
    [0] => Array
        (
            [orderId] => 3
            [qty] => 200
            [dailyUsedQty] => 10
            [balQty] => 190
            [createdDate] => 2014-06-27
        )

    [1] => Array
        (
            [orderId] => 3
            [qty] => 200
            [dailyUsedQty] => 20
            [balQty] => 170
            [createdDate] => 2014-06-27
        )

    [2] => Array
        (
            [orderId] => 3
            [qty] => 200
            [dailyUsedQty] => 50
            [balQty] => 120
            [createdDate] => 2014-06-27
        )

)

这是我的数组如何将这个数组写入phpexcel,我是php和php excel的新手。

1 个答案:

答案 0 :(得分:0)

使用工作表的fromArray()方法

$objPHPExcel->getActiveSheet()
    ->fromArray($myArray);