views:

697

answers:

1

I am trying to generate a pdf which contains a table with split/merged cells looking like so:

Cell | Cell       | Cell
Cell | C1 | C2 | Cell
       | C1 | C2 | Cell

I am using fpdf and was referred to the multicell table script, which I have used previously in similar pdfs. I looked at the code and can't think of a way to make the cells split or merge according to what I need. Does anyone know how to do this?

+1  A: 

Just do it manually so that the cell width becomes the sum of both of the merged cells.

As per your example there:

$column_widths = ['50','50','50','50'];

// first row
$pdf->Cell($column_widths[0],5,"Cell",'',0,'C',false);
$pdf->Cell($column_widths[1]+$column_widths[2],5,"Cell",'',0,'C',false);
$pdf->Cell($column_widths[3],5,"Cell",'',0,'C',false);

// second row
$pdf->Cell($column_widths[0],5,"Cell",'',0,'C',false);
$pdf->Cell($column_widths[1],5,"C1",'',0,'C',false);
$pdf->Cell($column_widths[2],5,"C2",'',0,'C',false);
$pdf->Cell($column_widths[3],5,"Cell",'',0,'C',false);

Or something like that.

Josh Pinter