Jump to content
Fórum Script Brasil
  • 0

Relatorio utilizando TCPDF


Spy_br
 Share

Question

Estou utilizando o TCPDF para fazer um relatorio que gera várias planilhas com os resultados da consulta do banco.

Está funcionando tudo certo, entretanto quando muda de pagina está quebrando no meio da celula. 

 

tabela1.jpg

 

 

alguém sabe uma forma de corrigir esse problema? Gostaria que a divisão ficasse em cima da linha da celula.
Outra coisa, como faço para centralizar os dados no meio da celula?


Segue abaixo o codigo que estou utilizando para gerar e preecher a tabela:

//------------------------------------------
      //Generating the HEADER Table
      //
      $tbl = '<table border="1" align="center">
         <tr bgcolor="#DDDDDD" valign="middle">
            <th rowspan="2">a1<br></th>
            <th rowspan="2">a2<br></th>
            <th rowspan="2">a3</th>
            <th rowspan="2">a4<br></th>
            <th rowspan="2">a5<br></th>
            <th colspan="2">b<br></th>
            <th rowspan="2" width="80">a8)<br></th>
            <th rowspan="2">a9 <br></th>
            <th rowspan="2">a10<br></th>
            <th rowspan="2">a11<br></th>
            <th rowspan="2">a12<br></th>
            <th rowspan="2">a13<br></th>      
         </tr>
         <tr bgcolor="#DDDDDD" valign="middle">
            <td>a6</td>
            <td>a7</td>
         </tr>';

      //</table>';
      
      while (!$rs->EOF)
      {
         $tbl = $tbl . "<tr>";
            $tbl = $tbl . "<td>".$rs->fields[0]."</td>";
            $tbl = $tbl . "<td>".$rs->fields[1]."</td>";
            $tbl = $tbl . "<td>".$rs->fields[2]."</td>";
            $tbl = $tbl . "<td>".utf8_decode($rs->fields[3])."</td>";
            $tbl = $tbl . "<td>".utf8_decode($rs->fields[4])."</td>";
            $tbl = $tbl . "<td>".utf8_decode($rs->fields[5])."</td>";
            $tbl = $tbl . "<td>".utf8_decode($rs->fields[6])."</td>";
            $tbl = $tbl . "<td>".utf8_decode($rs->fields[7])."</td>";
            $tbl = $tbl . "<td>".$rs->fields[8]."</td>";
            $tbl = $tbl . "<td>".$rs->fields[9]."</td>";
            $tbl = $tbl . "<td>".$rs->fields[10]."</td>";
            $tbl = $tbl . "<td>".$rs->fields[11]."</td>";
            $tbl = $tbl . "<td>".$rs->fields[12]."</td>";
         $tbl = $tbl . "</tr>";
         $rs->MoveNext();
      }
      $tbl = $tbl . "</table>";

      $pdf->writeHTML($tbl, true, false, false, false, '');

 

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.2k
×
×
  • Create New...