darshanmodi2010 / dompdf

Automatically exported from code.google.com/p/dompdf
0 stars 0 forks source link

Table first data row in the same line of column headings #588

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When I tried to create demo pdf document to list all customers in table format 
the first row of table comes in same line of column headings.

Please check the attachement.

Thanks and Kind Regards,
Satish.

Original issue reported on code.google.com by dahitule...@gmail.com on 23 Jun 2015 at 7:59

Attachments:

GoogleCodeExporter commented 8 years ago
    $html =
        '<html>'.
        '<head>'.
            '<style>'.
                'table, td, th { border: 1px solid #D8A35E; padding:.2em; border-collapse: collapse;}'.
                'th { background-color: #D8A35E; color: white; }'.
            '</style>'.
        '</head>'.
        '<body>'.
            '<center><h3>Customers</h3></center>'.'<br />'.
            '<table>'.
                '<thead>';
                    $html .= '<th>Customer ID</th>';
                    $html .= '<th>Email</th>';
                    $html .= '<th>First Name</th>';
                    $html .= '<th>Last Name</th>';                  

            $html .=    '</thead>'.
                '<tbody>';

                foreach($data as $row) { 

                        $html .= '<tr>';
                        $html .= '<td>'.$row["customer_id"].'</td>';
                        $html .= '<td>'.$row["email_address"].'</td>';
                        $html .= '<td>'.$row["first_name"].'</td>';
                        $html .= '<td>'.$row["last_name"].'</td>';  
                        $html .= '</tr>';
                }   
    $html .=    '</tbody>'.
            '</table>'.
        '</body>'.
        '</html>';

The above Html code is written to generate pdf.

Please suggest if any changes are required. 

Original comment by dahitule...@gmail.com on 23 Jun 2015 at 8:47