单元格内的背景色在fpdf中不变 [英] Background Color inside a cell is not changing in fpdf
问题描述
我正在使用fpdf为我的报告生成pdf文件,对此我是新手. 我想更改单元格内的填充颜色,但是每当我重新加载页面时,都什么也没有 hapeens,它仍然是相同的白色填充颜色.这是我的代码:
Im using fpdf to generate a pdf file for my reports and Im new to this. I want to change the fill color inside a cell but whenever I reloaded the page, nothing hapeens, It still the same white fill color. Here is my code :
<?php
require("fpdf/fpdf.php");
$pdf = new FPDF('P','pt','Letter');
$pdf->SetFillColor(230,230,230);
$pdf->SetTitle("Title Here");
$pdf -> AddPage();
$pdf -> SetFont('Arial','',12);
?>
我的代码有什么问题?我遵循正确的方法来设置填充颜色,但是什么也没发生?谁能帮我解决这个问题?谢谢
What is wrong with my code? I followed the proper way of setting the fill color but nothing happens? Can anyone help me fix it? Thanks
推荐答案
Tyr之类的东西:
$pdf->setFillColor(230,230,230);
$pdf->Cell(0,10,$text,0,1,'L',1); //your cell
定义用于所有填充操作(填充的矩形和单元格背景)的颜色.它可以用RGB分量或灰度表示. 可以在创建第一页之前调用该方法,并在每一页之间保留该值.
Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
看看 FPDF手册
这篇关于单元格内的背景色在fpdf中不变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!