这是我的桌子现在的样子。
你们可以清楚地看到某些文本溢出并且行的高度不同。我想要的是让每行相同的高度。例如,如果 IMPACTS
的数据最长,则 SS高度,省份,低空撒谎和建议的高度应与 IMPACTS 。与第二行及其后相同。
你们能帮我怎么做吗?谢谢。这是我的全部代码。
<?php
require("con.php")
$sql="SELECT * FROM table ORDER BY ssh REGEXP '^[^A-Za-z0-9]' ASC, ssh DESC";
$records=mysqli_query($sql);
$fetch = $records;
require("library/fpdf.php");
$pdf = new PDF('p', 'mm', 'Legal');
$title = 'Storm Surge Warning';
$pdf->SetTitle($title);
$pdf->AliasNbPages('{pages}');
$pdf->SetAutoPageBreak(true,40);
$pdf->AddPage();
$chartX=10;
$chartY=34;
$chartWidth=194;
$chartHeight=18;
$chartTopPadding=10;
$chartLeftPadding=20;
$chartBottomPadding=20;
$chartRightPadding=5;
$chartBoxX=$chartX+$chartLeftPadding;
$chartBoxY=$chartY+$chartTopPadding;
$chartBoxWidth=$chartWidth-$chartLeftPadding-$chartRightPadding;
$chartBoxHeight=$chartHeight-$chartTopPadding-$chartBottomPadding;
$pdf->Rect($chartX, $chartY, $chartWidth, $chartHeight);
$pdf->SetFont('Arial', 'B', 10);
$pdf->MultiCell(194,4,"STORM SURGE INFORMATION",0,'C', false);
$pdf->MultiCell(194,4, "STORM SURGE: WARNING # " . $fetch['warning'], 0,'C', false);
$pdf->MultiCell(194,4,"FOR: TYPHOON " . $fetch['typhoon'], 0,'C', false);
$pdf->MultiCell(194,4,"ISSUED AT " . $fetch['date'], 0,'C', false);
$pdf->Ln(1);
$pdf->SetBorders(array('LT', 'LT', 'LT', 'LT', 'TLR'));
$pdf->SetWidths(array(25, 27, 35, 54, 53));
$pdf->SetAligns(array('C', 'C', 'C', 'C', 'C'));
$pdf->SetFont('Arial', 'B', 10);
$x = 70;
$y = 50;
$pdf->Row(array("SS Height",
"Provinces",
"Low Lying Coastal Areas in the Municipalities of:",
"IMPACTS",
"ADVICE/Actions to Take"), 1);
$pdf->SetFont('Arial', '', 11);
$pdf->SetAligns(array('C', 'C', 'C', 'L', 'L'));
while($row = mysql_fetch_array($records)){
$x = $pdf->GetX();
$y = $pdf->GetY();
switch ($row['ssh']) {
case '2-3Meters' :
$pdf->SetFillColor(191, 143, 0);
$pdf->Cell(25, 75, $row['ssh'], 1, 0, 'C', TRUE);
break;
case '1-2Meters' :
$pdf->SetFillColor(255, 255, 0);
$pdf->Cell(25, 50, $row['ssh'], 1, 0, 'C', TRUE);
break;
case '<1Meter' :
$pdf->SetFillColor(91, 155, 213);
$pdf->Cell(25, 55, $row['ssh'], 1, 0, 'C', TRUE);
break;
default :
$pdf->Cell(25, 10, $row['ssh'], 1, 1, 'C', FALSE);
break;
}
$pdf->MultiCell(27,4,$row['provi'],1,'C');
$pdf->SetXY($x + 52, $y);
$pdf->Multicell(35,4,$row['muni'],1,'C');
$pdf->SetXY($x + 87, $y);
$pdf->Multicell(54,4,$row['impact'],1,'C');
$pdf->SetXY($x + 141, $y);
$pdf->Multicell(53,4,$row['advice'],1,'C');
}
$pdf->SetFillColor(255, 255, 255);
$pdf->OutPut();
?>