0
私は27列のテーブルを持っており、私はfpdf
を使ってPDFファイルを作成しています。最初の2文字以外のすべての列を右揃えにする方法は?
第1の2以外のすべての列を右揃えにするにはどうすればいいですか?
ここに私のコードです。
#Create the table
function BasicTable($header,$data) {
#Create the header.
foreach ($header as $col)
$this->Cell(18,5,$col,1);
$this->Ln();
#Get the data
foreach ($data as $row) {
foreach ($row as $col)
#$this->Cell(18,5,$col,1,'R');
$this->Cell(18,5, $col, 1, 0);
$this->Ln();
}
}
}
更新コード(ワーキング)
#Create the table
function BasicTable($header,$data) {
#Create the header.
foreach ($header as $col)
$this->Cell(18,5,$col,1);
$this->Ln();
#Get the data
foreach ($data as $row) {
$cnt = 0;
foreach ($row as $col) {
if($cnt < 2){
$this->Cell(18,5,$col,1);
}
else {
$this->Cell(18,5, $col, 1, 0,'R');
}
$cnt++;
}
$this->Ln();
}
}
}
SIR以上のポストに基づいて更新されたコードのplsのは –
が用事私はそれを修正私のために働いていない更新されたコードを参照してください。ご連絡先 –
それは機能していますか?他の人に役立つように修正プログラムを共有してください。 – Saurabh