Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

melx's avatar
Level 4

export excel with blade and the table has rowspan and cospan

am getting this error while i export excel from FormView blade

             PhpOffice\PhpSpreadsheet\Reader\Exception

Failed to load C:\Users\user\AppData\Local\Temp\laravel-excel-donQ3kVavbAqgvh0sN9LZ7AHMUBGANEW.html as a DOM Document

Export

            class DeviceStatusLocationExport implements FromView
                  {
                      /**
                      * @return \Illuminate\Support\Collection
                      */
                      public function view(): View
                      {
                          //
                      return view('rotatedevice.DSLExport',[
                          "T_Hb_master"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',1)
                          ->where('devices.devicebrand',2)->DISTINCT()->count('DeviceId'),

                          "T_Jt_master"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',1)
                          ->where('devices.devicebrand',1)
                          ->where('rotate_devices.status',0)->DISTINCT()->count('DeviceId'),

                          "T_Hb_slave"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',2)
                          ->where('devices.devicebrand',2)->DISTINCT()->count('DeviceId'),

                          "T_Jt_slave"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',2)
                          ->where('devices.devicebrand',1)
                          ->where('rotate_devices.status',0)->DISTINCT()->count('DeviceId'),
                          //STORE - Active ( Ready for Charging & lease )


                          "active_Hb_master"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',1)
                          ->where('devices.devicebrand',2)
                          ->where('rotate_devices.status',0)->DISTINCT()->count('DeviceId'),

                          "active_Hb_slave"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',2)
                          ->where('devices.devicebrand',2)
                          ->where('rotate_devices.status',0)->DISTINCT()->count('DeviceId'),


                          "active_Jt_master"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',1)
                          ->where('devices.devicebrand',1)
                          ->where('rotate_devices.status',0)->DISTINCT()->count('DeviceId'),

                          "active_Jt_slave"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',2)
                          ->where('devices.devicebrand',1)
                          ->where('rotate_devices.status',0)->DISTINCT()->count('DeviceId'),



                          //UTD- Maintenace-2
                          "maintenance_Hb_master"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',1)
                          ->where('devices.devicebrand',2)
                          ->where('rotate_devices.status',2)->DISTINCT()->count('DeviceId'),


                          "maintenance_Hb_slave"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',2)
                          ->where('devices.devicebrand',2)
                          ->where('rotate_devices.status',2)->DISTINCT()->count('DeviceId'),


                          "maintenance_Jt_master"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',1)
                          ->where('devices.devicebrand',1)
                          ->where('rotate_devices.status',2)->DISTINCT()->count('DeviceId'),

                          "maintenance_Jt_slave"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',2)
                          ->where('devices.devicebrand',1)
                          ->where('rotate_devices.status',2)->DISTINCT()->count('DeviceId'),



                          //UTD- Ground for Repair - Waiting for spare-3
                          "waitspare_Hb_master"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',1)
                          ->where('devices.devicebrand',2)
                          ->where('rotate_devices.status',3)->DISTINCT()->count('DeviceId'),


                          "waitspare_Hb_slave"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',2)
                          ->where('devices.devicebrand',2)
                          ->where('rotate_devices.status',3)->DISTINCT()->count('DeviceId'),


                          "waitspare_Jt_master"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',1)
                          ->where('devices.devicebrand',1)
                          ->where('rotate_devices.status',3)->DISTINCT()->count('DeviceId'),

                          "waitspare_Jt_slave"=>DB::table('rotate_devices')
                          ->leftJoin('devices','devices.id','=','rotate_devices.DeviceId')
                          ->leftJoin('device_types','device_types.id','=','devices.devicebrand')
                          ->where('devices.devicetype',2)
                          ->where('devices.devicebrand',1)
                          ->where('rotate_devices.status',3)->DISTINCT()->count('DeviceId'),

                      






                  ]);






                      }

My blade view

                <table >
                  <thead>
                    <tr>
                      <th >ITEMS DESC</th>
                      <th colspan="2" >Master</th>
                      <th colspan="2" >In Pcntg</th>
                      <th colspan="2" >Slave</th>
                      <th colspan="2" >In Pcntg</th>
                    </tr>
                    <tr>
                      <th></th>
                      <th>HB</th>
                      <th>JT</th>
                      <th>HB-%</th>
                      <th>JT-%</th>
                      <th>HB</th>
                      <th>JT</th>
                      <th>HB-%</th>
                      <th>JT-%</th>
                    </tr>

                  </thead>
                  <tbody>
                  <tr>
                    <td>STORE - Active ( Ready for Charging & lease )</td>
                    <td>{{$active_Hb_master}}</td>
                    <td>{{$active_Jt_master}}</td>
                    <td>{{number_format(($active_Hb_master/$T_Hb_master),2)}}</td>
                    <td>{{number_format(($active_Hb_master/$T_Jt_master),2)}}</td>
                    <td>{{$active_Hb_slave}}</td>
                    <td>{{$active_Jt_slave}}</td>
                    <td>{{number_format(($active_Hb_slave/$T_Hb_slave),2)}}</td>
                    <td>{{number_format(($active_Jt_slave/$T_Jt_slave),2)}}</td>
                  </tr>






                  <tr>
                    <td >UTD- Maintenace</td>
                    <td>{{$maintenance_Hb_master}}</td>
                    <td>{{$maintenance_Jt_master}}</td>
                    <td>{{number_format(($maintenance_Hb_master/$T_Hb_master),2)}}</td>
                    <td>{{number_format(($maintenance_Jt_master/$T_Jt_master),2)}}</td>
                    <td>{{$maintenance_Hb_slave}}</td>
                    <td>{{$maintenance_Jt_slave}}</td>
                    <td>{{number_format(($maintenance_Hb_slave/$T_Hb_slave),2)}}</td>
                    <td>{{number_format(($maintenance_Jt_slave/$T_Jt_slave),2)}}</td>
                  </tr>
                  <tr>
                    <td > UTD- Ground for Repair - Waiting for spare</td>
                    <td>{{$waitspare_Hb_master}}</td>
                    <td>{{$waitspare_Jt_master}}</td>
                    <td>{{number_format(($waitspare_Hb_master/$T_Hb_master),2)}}</td>
                    <td>{{number_format(($waitspare_Jt_master/$T_Jt_master),2)}}</td>
                    <td>{{$waitspare_Hb_slave}}</td>
                    <td>{{$waitspare_Jt_slave}}</td>
                    <td>{{number_format(($waitspare_Hb_slave/$T_Hb_slave),2)}}</td>
                    <td>{{number_format(($waitspare_Jt_slave/$T_Jt_slave),2)}}</td>
                  </tr>
                  <tr>
                    <td>UTD - Beyond Repair - Not able to be rectify </td>
                    <td>{{$beyondrepair_Hb_master}}</td>
                    <td>{{$beyondrepair_Jt_master}}</td>
                    <td>{{number_format(($beyondrepair_Hb_master/$T_Hb_master),2)}}</td>
                    <td>{{number_format(($beyondrepair_Jt_master/$T_Jt_master),2)}}</td>
                    <td>{{$beyondrepair_Hb_slave}}</td>
                    <td>{{$beyondrepair_Jt_slave}}</td>
                    <td>{{number_format(($beyondrepair_Hb_slave/$T_Hb_slave),2)}}</td>
                    <td>{{number_format(($beyondrepair_Jt_slave/$T_Jt_slave),2)}}</td>

                  </tr>
                  <tr >
                    <td > Issued - Out For Lease</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                  </tr>
                  <tr>
                    <td >In Port Stock</td>
                    <td>{{$port_stock_hb_Master}}</td>
                    <td>{{$port_stock_Jt_Master}}</td>
                    <td>{{number_format(($port_stock_hb_Master/$T_Hb_master),2)}}</td>
                    <td>{{number_format(($port_stock_Jt_Master/$T_Jt_master),2)}}</td>
                    <td>{{$port_stock_hb_slave}}</td>
                    <td>{{$port_stock_Jt_slave}}</td>
                    <td>{{number_format(($port_stock_hb_slave/$T_Hb_slave),2)}}</td>
                    <td>{{number_format(($port_stock_Jt_slave/$T_Jt_slave),2)}}</td>
                  </tr>
                  <tr>
                    <td> In Transit-On Sale</td>
                    <td>{{$inTransit_hb_Master}}</td>
                    <td>{{$inTransit_Jt_Master}}</td>
                    <td>{{number_format(($inTransit_hb_Master/$T_Hb_master),2)}}</td>
                    <td>{{number_format(($inTransit_Jt_Master/$T_Jt_master),2)}}</td>
                    <td>{{$inTransit_hb_slave}}</td>
                    <td>{{$inTransit_Jt_slave}}</td>
                    <td>{{number_format(($inTransit_hb_slave/$T_Hb_slave),2)}}</td>
                    <td>{{number_format(($inTransit_Jt_slave/$T_Jt_slave),2)}}</td>
                  </tr>
                  <tr>
                    <td > In Border Stock</td>
                    <td>{{$border_stock_Hb_master}}</td>
                    <td>{{$border_stock_Jt_master}}</td>
                    <td>{{number_format(($border_stock_Hb_master/$T_Hb_master),2)}}</td>
                    <td>{{number_format(($border_stock_Jt_master/$T_Jt_master),2)}}</td>
                    <td>{{$border_stock_Hb_slave}}</td>
                    <td>{{$border_stock_Jt_slave}}</td>
                    <td>{{number_format(($border_stock_Hb_slave/$T_Hb_slave),2)}}</td>
                    <td>{{number_format(($border_stock_Jt_slave/$T_Jt_slave),2)}}</td>
                  </tr>
                  <tr>
                    <td>RFB - Return From Border</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                  </tr>
                  <tr >
                    <td>Lost Units</td>
                    <td>{{$lost_Hb_master}}</td>
                    <td>{{$lost_Jt_master}}</td>
                    <td>{{number_format(($lost_Hb_master/$T_Hb_master),2)}}</td>
                    <td>{{number_format(($lost_Jt_master/$T_Jt_master),2)}}</td>
                    <td>{{$lost_Hb_slave}}</td>
                    <td>{{$lost_Jt_slave}}</td>
                    <td>{{number_format(($lost_Hb_slave/$T_Hb_slave),2)}}</td>
                    <td>{{number_format(($lost_Jt_slave/$T_Jt_slave),2)}}</td>
                  </tr>
                  <tr>
                    <td >Un-reconcile location</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                  </tr>
                  <tr>
                    <td></td>
                  </tr>
                  <tr >
                    <td >TOTAL DEVICE</td>
                    <td style="border-bottom:double black;">5,409.00 </td>
                    <td style="border-bottom:double black;">100.00%	</td>
                    <td style="border-bottom:double black;">5,409.00</td>
                    <td style="border-bottom:double black;">100.00%</td>
                    <td style="border-bottom:double black;">5,409.00</td>
                    <td style="border-bottom:double black;">100.00%</td>
                    <td style="border-bottom:double black;">100.00%</td>
                    <td style="border-bottom:double black;">100.00%</td>
                  </tr>
                  </tbody>
                </table>
0 likes
0 replies

Please or to participate in this conversation.