php中fpdf单元格中的内容重叠
我创建了一个简单的文件来将表数据导出到pdf。 我的php文件代码:-php中fpdf单元格中的内容重叠,php,mysql,Php,Mysql,我创建了一个简单的文件来将表数据导出到pdf。 我的php文件代码:- include("connection.php"); include('fpdf.php'); $pdf=new FPDF(); $inc=1; $r_type=$_GET['r_type']; $pdf->SetFont('Arial','',14); $pdf->AddPage(); $w = array(20,60,65,80,50,50); $header=array('Sr.No', 'N
include("connection.php");
include('fpdf.php');
$pdf=new FPDF();
$inc=1;
$r_type=$_GET['r_type'];
$pdf->SetFont('Arial','',14);
$pdf->AddPage();
$w = array(20,60,65,80,50,50);
$header=array('Sr.No', 'Name', 'Email', 'Property_Address','Property_Status','Property_Type');
for($i=0;$i<count($header);$i++)
$pdf->Cell($w[$i],7,$header[$i],1,'L');
$pdf->Ln();
$pdf->SetTextColor(0);
$pdf->SetFont('');
$real_sql=mysql_query("SELECT * FROM `detail_view`") or die ("error :" . mysql_error());
if(mysql_num_rows($real_sql) > 0)
{
while($ra=mysql_fetch_assoc($real_sql)){
$location= $ra['location'];
$year_built= $ra['year_built'];
$owner_name=$ra['owner_name'];
$owner_no= $ra['owner_no'];
$owner_email= $ra['owner_email'];
$type=$ra['type'];
$property_type=$ra['property_type'];
$property_type2=str_replace('_',' ',$property_type);
$sq_ft=$ra['sq_ft'];
$bhk=$ra['bhk'];
$price=$ra['price'];
$post_date=$ra['post_date'];
$reg_date=$ra['reg_date'];
$pdf->Cell($w[0],6,$inc,1,'L');
$pdf->Cell($w[1],6,$owner_name,1,'L');
$pdf->Cell($w[2],6,$owner_email,1,'L');
$pdf->Cell($w[3],6,$location,1,'L');
$pdf->Cell($w[4],6,$type,1,'L');
$pdf->Cell($w[5],6,$property_type2,1,'L');
$pdf->Ln();
$inc++;
}
//$pdf->Cell(array_sum($w),0,'','T');
}
$pdf->Output();
?>
include(“connection.php”);
包括('fpdf.php');
$pdf=新的FPDF();
$inc=1;
$r_type=$_GET['r_type'];
$pdf->SetFont('Arial','',14);
$pdf->AddPage();
$w=阵列(20,60,65,80,50,50);
$header=array('Sr.No','Name','Email','Property\u Address','Property\u Status','Property\u Type');
对于($i=0;$iCell($w[$i],7,$header[$i],1,'L');
$pdf->Ln();
$pdf->SetTextColor(0);
$pdf->SetFont(“”);
$real\u sql=mysql\u query(“从“详细信息视图”中选择*”)或die(“错误:.mysql\u error());
如果(mysql\u num\u rows($real\u sql)>0)
{
而($ra=mysql\u fetch\u assoc($real\u sql)){
$location=$ra['location'];
$year_Build=$ra['year_Build'];
$owner_name=$ra['owner_name'];
$owner_no=$ra['owner_no'];
$owner_email=$ra['owner_email'];
$type=$ra['type'];
$property_type=$ra['property_type'];
$property\u type2=str\u replace(“”,“”,$property\u type);
$sq_ft=$ra['sq_ft'];
$bhk=$ra['bhk'];
$price=$ra['price'];
$post_date=$ra['post_date'];
$reg_date=$ra['reg_date'];
$pdf->Cell($w[0],6,$inc,1,'L');
$pdf->Cell($w[1],6,$owner_name,1,'L');
$pdf->Cell($w[2],6,$owner_email,1,'L');
$pdf->Cell($w[3],6,$location,1,'L');
$pdf->Cell($w[4],6,$type,1,'L');
$pdf->Cell($w[5],6,$property_type2,1,'L');
$pdf->Ln();
$inc++;
}
//$pdf->Cell(数组和($w),0,,'T');
}
$pdf->Output();
?>
导出pdf文件时,表格单元格的内容彼此重叠。使用MultiCell时,单元格将转到下一行。因此,如何仅将内容包装到该单元格中???尝试此方法
CellFitScale()
CellFitScaleForce()
CellFitSpace()
CellFitSpaceForce()
完整描述
你能发布该文件的屏幕截图吗?你尝试过这个
FPDF::MultiCell()方法吗?
是的,但它会转到下一行。显然,它会转到下一行。因为你的字符串太长了。请检查: