Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用FPDF的多小区_Php_Fpdf - Fatal编程技术网

Php 使用FPDF的多小区

Php 使用FPDF的多小区,php,fpdf,Php,Fpdf,我正在创建一个包含七(7)列的表: PEDIDO | CANTIDAD | PENDIENTE | UNIDAD | Description | COSTO | NETO 这是我用来填充表的循环: do { $pdf->Cell(20, 8,$row_Recordset11['ordered'], 0,0,'C'); $pdf->Cell(20, 8,$row_Recordset11['quantity'], 0,0,'C'); $pdf->Cel

我正在创建一个包含七(7)列的表:

PEDIDO | CANTIDAD | PENDIENTE | UNIDAD | Description | COSTO | NETO

这是我用来填充表的循环:

do { 


    $pdf->Cell(20, 8,$row_Recordset11['ordered'], 0,0,'C');
    $pdf->Cell(20, 8,$row_Recordset11['quantity'], 0,0,'C');
    $pdf->Cell(20, 8,$row_Recordset11['pending'], 0,0,'C');

if ($row_Recordset11['material_or_service'] == 1){
    $pdf->Cell(20, 8, $row_Recordset11['unit_name'], 0,0,"C");


$cell_width = 70;
$current_y = $pdf->GetY();
$current_x = $pdf->GetX();

$pdf->MultiCell($cell_width, 8, $row_Recordset11['material_name'],0,"L", 0);

$pdf->SetXY($current_x + $cell_width, $current_y);
$current_x = $pdf->GetX();

}
if ($row_Recordset11['material_or_service'] == 2){
    $pdf->Cell(20, 8, $row_Recordset11['unit_name'], 0,0,"C");


$cell_width = 70;
$current_y = $pdf->GetY();
$current_x = $pdf->GetX();

$pdf->MultiCell($cell_width, 8, $row_Recordset11['service_name'],0,"L", 0);

$pdf->SetXY($current_x + $cell_width, $current_y);
$current_x = $pdf->GetX();

}
    $pdf->Cell(20, 8, "$ ".number_format($row_Recordset11['cost'], 2) , 0,0,'R');
    $pdf->Cell(20, 8, "$ ".number_format($row_Recordset11['net'], 2) , 0,0,'R');



    $pdf->Ln(4);
    } while ($row_Recordset11 = mysql_fetch_assoc($Recordset11)); 
如您所见,MultiCell()对象填充的唯一列是column description

我没有得到我需要的结果。在本例中,第一行和第二行对象在列description处有两行,但正如您在附加的图像中所看到的,这两行已打印出来,但第二行和第三行对象并没有从我期望的位置下方开始


欢迎任何帮助…

我已按如下方式解决了此问题:

do { 

$current_y = $pdf->GetY();
$current_x = $pdf->GetX();
$current_y2 = $current_y;
$current_x2 = $current_x;
    $pdf->Cell(20, 8,$row_Recordset11['ordered'], 0,0,'C');
    $pdf->Cell(20, 8,$row_Recordset11['quantity'], 0,0,'C');
    $pdf->Cell(20, 8,$row_Recordset11['pending'], 0,0,'C');

if ($row_Recordset11['material_or_service'] == 1){
    $pdf->Cell(20, 8, $row_Recordset11['unit_name'], 0,0,"C");


$cell_width = 70;
$current_x2 = $pdf->GetX();

$pdf->MultiCell($cell_width, 8, $row_Recordset11['material_name'],0,"L", 0);

$current_y2 = $pdf->GetY();


}


if ($row_Recordset11['material_or_service'] == 2){
    $pdf->Cell(20, 8, $row_Recordset11['unit_name'], 0,0,"C");


$cell_width = 70;
$current_x2 = $pdf->GetX();

$pdf->MultiCell($cell_width, 8, $row_Recordset11['service_name'],0,"L", 0);

$current_y2 = $pdf->GetY();


}



$pdf->SetXY($current_x2 + $cell_width, $current_y);


    $pdf->Cell(20, 8, "$ ".number_format($row_Recordset11['cost'], 2) , 0,0,'R');
    $pdf->Cell(20, 8, "$ ".number_format($row_Recordset11['net'], 2) , 0,0,'R');

$pdf->SetXY($current_x, $current_y2);


    } while ($row_Recordset11 = mysql_fetch_assoc($Recordset11));

您是否尝试过增加行高以查看它是否对您的字体太小,例如,
$pdf->MultiCell($cell\u-width,12,…
而不是
$pdf->MultiCell($cell\u-width,8,…