Jump to content


Photo

Relatório Pdf .. Usando O Fpdf


  • Faça o login para participar
3 replies to this topic

#1 xulapa4fun

xulapa4fun

    Novato no fórum

  • Usuários
  • 18 posts
  • Sexo:Não informado

Posted 08/02/2007, 11:50

ae galera!

quero farzer um relatorio.. dos registros da tabela.. listando um em baixo do outro, mas quando listo.. aparece uma em cima do outro.. e se lorna ilegivel....


$consulta = mysql_query("select * from tabela  ORDER BY nome ASC");  
$total = mysql_num_rows($consulta);

for($i=0; $i<$total; $i++) {

$pdf->SetFont('Arial','',40);
$pdf->SetY(90); 
[color=#990000]$pdf->Ln(10); // quebra linha... q "nao funciona"[/color]
			
$pdf->Cell(0,0, mysql_result($consulta, $i, "nome"));

}

tentei assim tbm:

$consulta = mysql_query("select * from tb ORDER BY nome ASC");
while($resultado = mysql_fetch_array($consulta)){

$pdf->ln(20);
$pdf->SetFont('Arial','',40);
$pdf->SetY(90);
$pdf->Cell(0,0, "$resultado[nome]");

}


e nada

Edição feita por: xulapa4fun, 08/02/2007, 12:06.


#2 kleryson

kleryson

    Mestre

  • Usuários
  • 687 posts
  • Sexo:Masculino

Posted 08/02/2007, 14:31

Na classe fpdf tem um parâmetro que significa quebra de linha veja:

Cell(float w [, float h [, string txt [, mixed border [, int ln [, string align [, int fill [, mixed link]]]]]]])

w

Cell width. If 0, the cell extends up to the right margin.

h

Cell height. Default value: 0.

txt

String to print. Default value: empty string.

border

Indicates if borders must be drawn around the cell. The value can be either a number:

* 0: no border
* 1: frame

or a string containing some or all of the following characters (in any order):

* L: left
* T: top
* R: right
* B: bottom

Default value: 0.

ln (quebra de linha)

Indicates where the current position should go after the call. Possible values are:

* 0: to the right
* 1: to the beginning of the next line
* 2: below

Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.

align

Allows to center or align the text. Possible values are:

* L or empty string: left align (default value)
* C: center
* R: right align

fill

Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.

link

URL or identifier returned by AddLink().


Blz...

#3 MastersRoX

MastersRoX

    EDITADO

  • Banidos
  • PipPipPipPipPipPipPipPip
  • 774 posts
  • Sexo:Não informado

Posted 08/02/2007, 14:42

tbm tenho esse problema....

mas ele ta usando o $pdf->ln(20); ....

não viu la no code ?!?!?

Edição feita por: MastersRoX, 08/02/2007, 15:31.


#4 xulapa4fun

xulapa4fun

    Novato no fórum

  • Usuários
  • 18 posts
  • Sexo:Não informado

Posted 08/02/2007, 15:58

entao!

consegui... era so tirar o $pdf->SetY(90); !!!

$consulta = mysql_query("select * from tb ORDER BY nome ASC");
while($resultado = mysql_fetch_array($consulta)){

$pdf->ln(20);
$pdf->SetFont('Arial','',40);
$pdf->Cell(0,0, "$resultado[nome]");

}




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq