【发布时间】:2012-02-04 22:46:15
【问题描述】:
我正在使用 fpdf 生成报告,但我需要多单元格的字段之一,因为内容可能只有几行。下面是现在发生的代码,多单元格将只有几行长,但其余部分将只有一个标准尺寸,多单元格之后的内容将在下一行。那么如何克服所有这些问题
$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 );
【问题讨论】:
-
兄弟,我也遇到了同样的问题,但我认为没有开发人员来解决它。所以我们受苦了。
标签: fpdf