2017-08-30 8 views
-1

印刷リストにFPDFを使用しています。現在、ClémentLavoillotteのWriteHTMLスクリプトを使用していますので、私のテーブルにHTMLタグを使用することができます。しかし、私はまた、セルに収まるように長いテキストを折り返したい。私はOlivierのTable with MultiCellsスクリプトを私が今持っているものとマージすることを考えているが、それを動作させることはできない。Merge 2 FPDFの関数

ここに私の問題があります。

enter image description here

どのように私は長い文章は、それが中だセルに収まることができますか?すべてのヘルプは高く評価されて

private function generate_picklist($bu_id,$ids,$isdebug=false){ 
    if (!$this->ion_auth->logged_in()) { echo 'access denied'; exit; } 
    ob_start(); 
    //Create PDF 
    require('application/libraries/htmltopdf/WriteHTML.php'); 

//SAVE THE PICKLIST NUMBER ON ITEMS 
//GENERATE PICKLIST NUMBER 
$len = "10"; 
$pick_list_no = ''; 
$pick_list_no = $code=sprintf("%0".$len."d", mt_rand(1, str_pad("", $len,"9"))); 

    $get_pick_list = $this->PrintModel->get_pick_list($bu_id, $ids, $pick_list_no); 

    $pdf=new PDF_HTML(); 

    $pdf->AliasNbPages(); 
    $pdf->SetAutoPageBreak(true, 15); 
    $pdf->PageNo(); 
    $pdf->addPage('L'); 

    $this->pdf_header($pdf,$bu_id,'Pick List','Date: '.date("Y/m/d"), '', 'PL #: '.$get_pick_list[0]['picklist_no']); 

    $rc_y = 20; 

    $pdf->SetXY(10,$rc_y + 40); 

    $header = array(array('name'=>'Date Received','width'=>45), 
        array('name'=>'Customer Name','width'=>45), 
     array('name'=>'Vendor','width'=>30), 
        array('name'=>'Item','width'=>45), 
        array('name'=>'Quantity','width'=>25), 
        array('name'=>'Price','width'=>30), 
     array('name'=>'Shelf #','width'=>30), 
    ); 
    $row_ht = 7; 

    // Header 
    $pdf->SetFillColor(51, 122, 183); 
    $pdf->SetTextColor(255); 
    $pdf->SetDrawColor(0,0,0);//$pdf->SetDrawColor(128,0,0); 
    $pdf->SetLineWidth(.1); 
    $pdf->SetFont('Arial','',11); 
    for($i=0;$i<count($header);$i++) { 
     $pdf->Cell($header[$i]['width'],$row_ht,$header[$i]['name'],1,0,'C',true); 
    } 
    $pdf->Ln(); 

    // ROW Color and font restoration 
    $pdf->SetFillColor(224, 235, 255); 
    $pdf->SetTextColor(0); 
    $pdf->SetFont('Arial','',9); 
    // Data 
    $fill = false; $crt = 1; $lnt = count($boxes); 

    foreach($get_pick_list AS $get_pick_list_data){ 
     $brdr = 'LR'; 
     if ($crt == $lnt) $brdr = 'LRB'; 


     $pdf->Cell($header[0]['width'],$row_ht,' '.$get_pick_list_data['date_received'],$brdr,0,'C',$fill); 
     $pdf->Cell($header[1]['width'],$row_ht,' '.$get_pick_list_data['customer_name'],$brdr,0,'L',$fill); 
    $pdf->Cell($header[2]['width'],$row_ht,' '.$get_pick_list_data['vendor_name'],$brdr,0,'L',$fill); 
     $pdf->Cell($header[3]['width'],$row_ht,' '.$get_pick_list_data['item_description'],$brdr,0,'L',$fill); 
     $pdf->Cell($header[4]['width'],$row_ht,' '.$get_pick_list_data['qty'] ,$brdr,0,'C',$fill); 
     $pdf->Cell($header[5]['width'],$row_ht,' '.$get_pick_list_data['price'],$brdr,0,'R',$fill); 
    $pdf->Cell($header[6]['width'],$row_ht,' '.$get_pick_list_data['shelf_no'],$brdr,0,'C',$fill); 

     $pdf->Ln(); 
     $fill = !$fill; 
     $crt +=1; 
    } 
    // Closing line 
$pdf->Cell(250, 0, '', 'T'); 
    if ($isdebug==true){ 
     $path_to_pdf = 'assets/pdf/picklist.pdf'; 

     if (file_exists($path_to_pdf)) { unlink($path_to_pdf); } 
     $pdf->Output($path_to_pdf,'D'); 
     ob_end_flush(); 
    } else { 
     $path_to_pdf = 'assets/pdf/picklist-'.'xx'.'.pdf'; 
     $pdfdoc = $pdf->Output($path_to_pdf, "F"); 
     ob_end_flush(); 
    } 
    return array('status'=>1, 'msg'=>''); 
} 

は、ここに私のコードです。ありがとう!

-Eli

答えて

-1

あなたはwidth 100%を行う必要があると​​もだからあなたの答えのための

table { 
     table-layout: auto; 
     width: 100%; 
}  
table td { 
     white-space: nowrap 
} 
+0

感謝を追跡するために、テーブルスタイルを追加coloumにwhite-space nowrap

をCSSを追加設定。しかし、どこにCSSを追加すべきですか? –

+0

あなたはWriteHTML(http://www.fpdf.org/en/script/script42.php)を使用していますので、ヘッド部分で '' '