FPDF multicell that of in a same row two colors of filling

0

I wanted the multicell function to fill in ONE SAME ROW with two different colors ... I've already seen a for loop with the modulo operation of two to fix the colors, but that's not what I'm looking for, I want the same row in horizontal have two colors. Currently I do it like this but I do not know how I can change the color in the multicell ...

function RowOscuro($data)
{
    $nb=0;
    for($i=0;$i<count($data);$i++)
        $nb=max($nb,$this->NbLines($this->widths[$i],$data[$i]));
    $h=8*$nb;
    $this->CheckPageBreak($h);
    for($i=0;$i<count($data);$i++)
    {
        $w=$this->widths[$i];
        $a=isset($this->aligns[$i]) ? $this->aligns[$i] : 'L';
        $x=$this->GetX();
        $y=$this->GetY();
        $this->Rect($x,$y,$w,$h);
        $this->SetFillColor(122,196,117); //relleno
        $this->SetDrawColor(255,255,255); //borde
        $this->SetTextColor(0,0,0); //letra
        $this->MultiCell($w,8,$data[$i],1,$a,'true');
        $this->SetXY($x+$w,$y);
    }
    $this->Ln($h);
}

Faced with the impossibility of placing two cells of different color in the same row with multicell, I decided to use cell and put these cells one after another, but I do not cosnigo it.

    $pdf->SetWidths(array(12,100,12));
    $pdf->Row(array("",utf8_decode("FICHA CÓDIGO COLORES"),""));
    $pdf->SetWidths(array(62,62));
    $pdf->Row(array('Equipo','Curso'));

    $pdf->SetFillColor(186,223,184); 
    $pdf->SetDrawColor(255,255,255); //borde
    $pdf->Cell(20,0,utf8_decode("Orden"),1,1,'C');  
    $pdf->Cell(20,0,utf8_decode("Nº1"),1,1,'C');  
    $pdf->Cell(20,0,utf8_decode("Color1"),0,1,'C');  

    $pdf->SetFillColor(0,223,0); 
    $pdf->Cell(22,0,"",0,1,'C'); 

    $pdf->SetFillColor(186,223,184); 
    $pdf->Cell(20,0,utf8_decode("Color2"),0,1,'C');  

    $pdf->SetFillColor(0,223,0); 
    $pdf->Cell(22,0,"",0,1,'C'); 

but the cell pulls out a blank row, what is the error?

Thank you very much, best regards.

    
asked by midlab 01.03.2018 в 17:33
source

0 answers