如何使单元格自动调整?我正在从数据库中提取数据,其中一些在段落中,所以我使用了Multicell
方法,因此文本不会溢出。这种方法使我的桌子更长。现在,我很难调整电池使其完全适合。
您可以清楚地看到我的单元格的颜色重叠,并且某些单元格的宽度与上面的标题不匹配。有人可以帮我解决这个问题吗?非常感谢。
这是我的密码。
<?php
require("con.php");
$sql="SELECT * FROM table ORDER BY ssh REGEXP '^[^A-Za-z0-9]' ASC, ssh DESC";
$records=mysql_query($sql);
$fetch = mysql_fetch_array($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();
$pdf->SetBorders(array('LT', 'LT', 'LT', 'LT', 'TLR'));
$pdf->SetWidths(array(25, 27, 35, 54, 53));
$pdf->SetAligns(array('C', 'C', 'C', 'L', 'L'));
$pdf->SetFont('Arial', 'B', 10);
$pdf->Row(array("SS Height",
"Provinces",
"Low Lying Coastal Areas in the Municipalities of:",
"IMPACTS",
"ADVICE/Actions to Take"), 1);
$pdf->SetFont('Arial', '', 11);
while($row = mysql_fetch_array($records)){
switch ($row['ssh']) {
case '2-3Meters' :
$pdf->SetFillColor(191, 143, 0);
$pdf->Cell(25, 80, $row['ssh'], 1, 0, 'C', TRUE);
break;
case '1-2Meters' :
$pdf->SetFillColor(255, 255, 0);
$pdf->Cell(25, 50, $row['ssh'], 1, 0, 'C', FALSE);
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->Row(array(
//$row['ssh'],
$row['provi'],
$row['muni'],
$row['impact'],
$row['advice']), 1);
}
$pdf->SetBorders(array('T', 'T', 'T', 'T', 'T'));
$pdf->Row(array('','','','',''), 1, false, 1);
$pdf->SetFillColor(255, 255, 255);
$pdf->OutPut();
?>