Dear All,
I am using fpdf to generate a report but one of the field I need to be multicell as the contents can be few lines long. Below is the codes what happens now is that the multicell will be few lines long but the rest of it will be only one standard size and the content after multicell will be on the next line. So how to overcome all this problem.

$row_height = 5; // set the default             
$column_width = 15;

$number_of_lines = ceil( $pdf->GetStringWidth($eventMessage) / ($column_width - 1) );
$cell_height = 5; 
$height_of_cell = ceil( $number_of_lines * $cell_height ); 
if ( $cell_height > $row_height ) {
 $row_height = $cell_height;
}  

$pdf->Cell( 10, $row_height,$count, 1, 0, 'L', true );
$pdf->Cell( 15, $row_height,$row['latitude'], 1, 0, 'L', true );
$pdf->Cell( 16, $row_height,$row['longitude'], 1, 0, 'L', true );
$pdf->Cell( 25, $row_height,$row['dateTimer'], 1, 0, 'L', true );
$pdf->Cell( 25, $row_height,$row['insertDateTime'], 1, 0, 'L', true );

$pdf->MultiCell( 15, $row_height,$eventMessage, 1, 'J',true);
$pdf->Cell( 15, $row_height,$eventSource, 1, 0, 'L', true );
$pdf->Cell( 15, $row_height,$eventLocation, 1, 0, 'L', true );
$pdf->Cell( 18, $row_height,$row['stat'], 1, 0, 'L', true );

According to the example/tutorial you should reset the column after using MultiCell. See tutorial 4 for code.

Dear Pritaeas,
I have seen is this what you want me to follow? So what must I change to accommodate this?

function SetCol($col)
{
    // Set position at a given column
    $this->col = $col;
    $x = 10+$col*65;
    $this->SetLeftMargin($x);
    $this->SetX($x);
}

Call it after multi-cell, just like in the example where you got it from.

Dear Pritaeas,
I think you are referring the to the setXY right but what value to put and how to adjust dynamically is where my problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.