Código PHP:
Ver originalclass PDF_MySQL_Table extends FPDF
{
var $ProcessingTable=false;
var $TableX;
var $HeaderColor;
var $RowColors;
var $ColorIndex;
{
//Print the table header if necessary
if($this->ProcessingTable)
$this->TableHeader();
}
function TableHeader()
{
$this->SetFont('Arial','B',12);
$this->SetX($this->TableX);
$fill=!empty($this->HeaderColor); if($fill)
$this->SetFillColor($this->HeaderColor[0],$this->HeaderColor[1],$this->HeaderColor[2]);
foreach($this->aCols as $col)
$this->Cell($col['w'],6,$col['c'],1,0,'C',$fill);
$this->Ln();
}
function Row($data)
{
$this->SetX($this->TableX);
$ci=$this->ColorIndex;
$fill=!empty($this->RowColors[$ci]); if($fill)
$this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]);
foreach($this->aCols as $col)
// esto agregue $data[$col['f']] = str_replace($find, $repl, $data[$col['f']]);
$this->Cell($col['w'],5,$data[$col['f']],1,0,$col['a'],$fill);
$this->Ln();
$this->ColorIndex=1-$ci;
}
function CalcWidths($width,$align)
{
//Compute the widths of the columns
$TableWidth=0;
foreach($this->aCols as $i=>$col)
{
$w=$col['w'];
if($w==-1)
$w=$width/count($this->aCols); $w=$w/100*$width;
$this->aCols[$i]['w']=$w;
$TableWidth+=$w;
}
//Compute the abscissa of the table
if($align=='C')
$this->TableX=max(($this->w-$TableWidth)/2,0); elseif($align=='R')
$this->TableX=max($this->w-$this->rMargin-$TableWidth,0); else
$this->TableX=$this->lMargin;
}
function AddCol($field=-1,$width=-1,$caption='',$align='L')
{
//Add a column to the table
if($field==-1)
$field=count($this->aCols); $this->aCols[]=array('f'=>$field,'c'=>$caption,'w'=>$width,'a'=>$align); }
function Table
($query,$prop=array()) {
//Issue query
//Add all columns if none was specified
if(count($this->aCols)==0) {
for($i=0;$i<$nb;$i++)
$this->AddCol();
}
//Retrieve column names when not specified
foreach($this->aCols as $i=>$col)
{
if($col['c']=='')
{
$this->aCols[$i]['c']=ucfirst($col['f']); else
}
}
//Handle properties
if(!isset($prop['width'])) $prop['width']=0;
if($prop['width']==0)
$prop['width']=$this->w-$this->lMargin-$this->rMargin;
if(!isset($prop['align'])) $prop['align']='C';
if(!isset($prop['padding'])) $prop['padding']=$this->cMargin;
$cMargin=$this->cMargin;
$this->cMargin=$prop['padding'];
if(!isset($prop['HeaderColor'])) $prop['HeaderColor']=array(); $this->HeaderColor=$prop['HeaderColor'];
if(!isset($prop['color1'])) if(!isset($prop['color2'])) $this->RowColors=array($prop['color1'],$prop['color2']); //Compute column widths
$this->CalcWidths($prop['width'],$prop['align']);
//Print header
$this->TableHeader();
//Print rows
$this->SetFont('Arial','',11);
$this->ColorIndex=0;
$this->ProcessingTable=true;
$this->Row($row);
$this->ProcessingTable=false;
$this->cMargin=$cMargin;
}
}
Probe lo de la codificación al row que me aconsejaste pero no funciono.
Este es el archivo mysql_table.php completo, en la function Row($data) se encuentra los datos en el array $data[$col['f']] pero a ponerle el srt_replace desaparecen las primeras dos columnas solo muestra la ultima.