2013-03-28 39 views
1

我用這個庫FPDF製作了一些非常簡單的PDF,現在我試圖製作一個「結果頁面」,它必須顯示像這樣的圖像,但是圍繞它的所有邊框,不是每個細胞。FPDF borderlines

a border must surround all the variables

我已經得到了在FPDF,提出將細胞(不知道這是最好的方式做的話),和代碼是這樣的(因爲我用手工添加的結果的那一刻,只是要弄清楚它是如何將看起來像):

//SimpleTable 
function SimpleTable() { 
    $this->Cell(280,15,"Inscription Number: 1",0); 
    $this->Cell(265,15,"Date: 28/03/2008",0); 
    $this->Ln(); 
    $this->Cell(265,15,"Name and Surname: Name Surname ",0); 
    $this->Cell(265,15,"",0); 
    $this->Ln(); 
    $this->Cell(280,15,"Address: Address",0); 
    $this->Cell(265,15,"",0); 
    $this->Ln(); 
    $this->Cell(280,15,"Zip Code: Zip Code",0); 
    $this->Cell(280,15,"City: City",0); 
    $this->Ln(); 
    $this->Cell(280,15,"Year of birth: Birthday",0); 
    $this->Cell(280,15,"Age: Age",0); 
    $this->Ln(); 
    $this->Cell(280,15,"VIP: No - First Time: Yes",0); 
    $this->Cell(280,15,"School: My school",0); 
} 

希望你能幫助我如何邊境一個所有thouse結果,我不beign能夠做到這一點,並沒有發現任何東西。

再次感謝您的時間,一如既往!

回答

0

感謝您的時間,但我終於找到了實現的途徑。在單元格的邊框選項中,我添加了「LT」,「RT」...,並且我可以製作一個圍繞所有的邊界線(如果你知道另一個更好的方法來製作它, ,我將不勝感激)。

希望這可以幫助其他人也希望這樣做!

0

您應該首先繪製一個空白單元格,並在其周圍放置一個邊框,然後您可以存儲您的Y位置並重置PDF位置並開始在邊框單元格中繪製您的單元格。 像這樣:

//The BorderBox 
$actual_position_y = $pdf->GetY(); 
$pdf->SetFillColor(255, 255, 255); 
$pdf->SetDrawColor(0, 0, 0); 
$pdf->Cell($your_content_width, $your_content_heigth, "", 1, 1, 'C'); 

//Your actual content 
$pdf->SetXY($yourLeftosition, $actual_position_y); 
$pdf->Cell($cellwidth, $cellheigth, "Inscription Number", 0, 1, 'C'); 
... 

希望這有助於:)

2

您可以使用

Rect(StartX, StartY, Width, Height, Options) 

選項

  • d - 畫線
  • 的F - 填寫
  • DF或FD - 繪製線條和填充

$pdf->Rect(0, 0, 210, 100, 'D'); FPDF的

0
//The BorderBox 
$actual_position_y = $pdf->GetY(); 
$pdf->SetFillColor(255, 255, 255); 
$pdf->SetDrawColor(0, 0, 0); 
$pdf->Cell($your_content_width, $your_content_heigth, "", 1, 1, 'C'); 

//Your actual content 
$pdf->SetXY($yourLeftosition, $actual_position_y); 
$pdf->Cell($cellwidth, $cellheigth, "Inscription Number", 0, 1, 'C'); 
0

使用FancyRow插件,給邊境或創建對話框如果需要檢查鏈接here,它可以幫助你。而另一個可以在這裏使用的插件是多單元表格,請查看link