doufei16736 2015-07-16 01:30
浏览 29

我正在使用函数ExportTableau()我创建新的PDF('L')我如何更改pdf的格式

I have problem with format of pdf when I use $pdf=new FPDF(''); it's allowed this error

Call to undefined method FPDF::ExportTableau()

so when I use this one $pdf=new PDF('L'); the format of pdf turned what can I do? I check for solution but I didn't found anything can someone help!

this is the problem the pdf is Turned

<?php
session_start();
require('../fpdf17/fpdf.php');

class PDF extends FPDF
{
//Chargement des données
function LoadData($file)
{
//Lecture des lignes du fichier
$lines=file($file);
$data=array();
foreach($lines as $line)
$data[]=explode(';',chop($line));
return $data;
}

//Tableau coloré
function ExportTableau($header,$data)
{
//Couleurs, épaisseur du trait et police grasse
$this->SetFillColor(150,180,255); //fond des entetes de colonnes
$this->SetTextColor(0); //couleur du texte des entetes des colonnes
$this->SetDrawColor(0); // couleur des bordures
$this->SetLineWidth(.3); //epaisseur des traits
$this->SetFont('','B');

//En-tête
$w=array(35,20,50,20,45);
for($i=0;$i<count($header);$i++)
    $this->Cell($w[$i],5,$header[$i],1,0,'C',1);
$this->Ln();

//Restauration des couleurs et de la police
$this->SetFillColor(224,235,255); //couleur du fond des cases
$this->SetTextColor(0); //couleur du texte des cases
$this->SetFont('');

//Données
$fill=false;
foreach($data as $row)
{
    $this->Cell($w[0],6,$row[0],'LR',0,'L',$fill);
    $this->Cell($w[1],6,$row[1],'LR',0,'L',$fill);
    $this->Cell($w[2],6,$row[2],'LR',0,'L',$fill);
    $this->Cell($w[3],6,$row[3],'LR',0,'L',$fill);
    $this->Cell($w[4],6,$row[4],'LR',0,'L',$fill);

    $this->Ln();
    $fill=!$fill;
}
$this->Cell(array_sum($w),0,'','T');
}
}
}
}
$pdf=new PDF('L');
$pdf->AddPage();
.
.
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 个人网站被恶意大量访问,怎么办
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制