如何格式化多单元格 fpdf 中的单个单元格 table
How to format a single cell in a multicell fpdf table
我正在使用带有 fpdf 的多单元 table
我想根据条件
用粗体字母格式化单元格的值
示例:
$pdf->SetFont('Arial','B',10);
$pdf->Row(array("","IDUSER","NAME","AGE"); //header of the table<BR>
do {
if($myrow["age"] >30)
$age=<b>$myrow["age"]; //value in bold letter<br>
else
$age=$myrow["age"];
$pdf->Row(array($n,$myrow["id_user"],$myrow["name"],$age));
} while ($myrow = mysql_fetch_array($result));
只需调用 SetFont
并使用 'B' 即可获得粗体,而无需使用 'B' 即可显示文本:
$pdf->SetFont('Arial','B',10);
$pdf->Row(array("","IDUSER","NAME","AGE"); //header of the table<BR>
do<br>
{<BR>
if($myrow["age"] >30)<br>
{ $pdf->SetFont('Arial','B',10); // ◄■■■■■■■■■■■■■ BOLD
$age=$myrow["age"]; //value in bold letter<br>
}
else{ <br>
$pdf->SetFont('Arial','',10); // ◄■■■■■■■■■■■■■ REGULAR.
$age=$myrow["age"];<br>
}
$pdf->Row(array($n,$myrow["id_user"],$myrow["name"],$age));<br>
} while ($myrow = mysql_fetch_array($result);<br>
另一种方法:
$pdf->SetFont('Arial','B',10);
$pdf->Row(array("","IDUSER","NAME","AGE"); //header of the table<BR>
do<br>
{<BR>
if($myrow["age"] >30)<br>
{ $font = "B"; // ◄■■■ BOLD FONT.
$age=$myrow["age"]; //value in bold letter<br>
}
else{ <br>
$font = ""; // ◄■■■ REGULAR FONT.
$age=$myrow["age"];<br>
}
$pdf->SetFont('Arial',$font,10); // ◄■■■ SET FONT.
$pdf->Row(array($n,$myrow["id_user"],$myrow["name"],$age));<br>
} while ($myrow = mysql_fetch_array($result);<br>
我正在使用带有 fpdf 的多单元 table 我想根据条件
用粗体字母格式化单元格的值示例:
$pdf->SetFont('Arial','B',10);
$pdf->Row(array("","IDUSER","NAME","AGE"); //header of the table<BR>
do {
if($myrow["age"] >30)
$age=<b>$myrow["age"]; //value in bold letter<br>
else
$age=$myrow["age"];
$pdf->Row(array($n,$myrow["id_user"],$myrow["name"],$age));
} while ($myrow = mysql_fetch_array($result));
只需调用 SetFont
并使用 'B' 即可获得粗体,而无需使用 'B' 即可显示文本:
$pdf->SetFont('Arial','B',10);
$pdf->Row(array("","IDUSER","NAME","AGE"); //header of the table<BR>
do<br>
{<BR>
if($myrow["age"] >30)<br>
{ $pdf->SetFont('Arial','B',10); // ◄■■■■■■■■■■■■■ BOLD
$age=$myrow["age"]; //value in bold letter<br>
}
else{ <br>
$pdf->SetFont('Arial','',10); // ◄■■■■■■■■■■■■■ REGULAR.
$age=$myrow["age"];<br>
}
$pdf->Row(array($n,$myrow["id_user"],$myrow["name"],$age));<br>
} while ($myrow = mysql_fetch_array($result);<br>
另一种方法:
$pdf->SetFont('Arial','B',10);
$pdf->Row(array("","IDUSER","NAME","AGE"); //header of the table<BR>
do<br>
{<BR>
if($myrow["age"] >30)<br>
{ $font = "B"; // ◄■■■ BOLD FONT.
$age=$myrow["age"]; //value in bold letter<br>
}
else{ <br>
$font = ""; // ◄■■■ REGULAR FONT.
$age=$myrow["age"];<br>
}
$pdf->SetFont('Arial',$font,10); // ◄■■■ SET FONT.
$pdf->Row(array($n,$myrow["id_user"],$myrow["name"],$age));<br>
} while ($myrow = mysql_fetch_array($result);<br>