I need to expend the coding developed by another programmer.

The original script only can show five page with no extra notice pdf. So I need to base on his coding to extend.

Now I am facing a problem about how can I put line break in multicell.
I try that I can success to give a line break in a multicell as

$pdf->MultiCell(5,2,"abcderg\nhijlmn",0,L);

it can pint in pdf
abcderg
hijlmn

But in my current program file. I don't know why I cannot take line break in multicell

I detail to read his coding and dicover their code to gen pdf ...

//--------------------------
	// BODY OF TABLE
	//--------------------------
	// THERE ARE 3 STEPS: 
	// 1. CALCULATE HEIGHT & LINE BREAK STUFF
	// 2. DRAW TABLE BORDER (NO CONTENT)
	// 3. FILL TABLE WITH TEXT
	///--------------------------
	// SET FONT TYPE, STYLE & COLOR FOR TABLE CONTENT
	$pdf->SetFont('uni','b',7);
	$pdf->SetTextColor(0,0,0);
	//**********************************************
	// STEP 1. CALCULATE HEIGHT & LINE BREAK STUFF
	//**********************************************
	for ($r=$startnum[$m]; $r<$endnum[$m];$r++){
		$pdf->SetCharSpacing(0);
		$pdf->SetFillColor(230,230,230);
		if ($r==$startnum[$m]){
			$rowPositionY[$r] = $Y_Table_Position; 
		} else {
			$rowPositionY[$r] = $rowPositionY[$r-1] + $rowHeight[$r-1];
		}
		if($checkSeries[$m]){
			if(($r==0)||($series[$r]<>$series[$r-1]&&$r<>0)){
				$pdf->SetY($rowPositionY[$r]);
				$pdf->MultiCell_noDraw(0,6,'',0,'L');
				$rowPositionY[$r] = $rowPositionY[$r] + 6;
			}
		}
		// -------------------------------------------------------------
		// ------------ COUNT CONTENT OF EACH CELL OF THE ROW ----------
		for($j=0; $j<count($headerContent[$m]['ratio']); $j++){
			$pdf->SetY($rowPositionY[$r]);
			$pdf->SetX($columnPositionX[$m][$j]);
			$numOfRows[$j]=$pdf->MultiCell_noDraw($columnWidth[$m][$j],CONSTANT_LINE_HEIGHT,$thisRowContent[$m][$r][$j],0,'L');
		}
		//------------- END OF DISPLAY CONTENT OF EACH CELL OF THE ROW -----------
		// -------------------------------------------------------------
		$thisRowHeight = max($numOfRows) * CONSTANT_LINE_HEIGHT;
		$rowHeight[$r] = $thisRowHeight;
		#echo $r.' is having the height of '.$rowHeight[$r].'<br>';
	}
	//**********************************************
	// STEP 2. DRAW TABLE BORDER (NO CONTENT)
	//**********************************************
	for ($r=$startnum[$m]; $r<$endnum[$m];$r++){
		//Create lines (boxes) for each ROW (Product)
		//If you don't use the following code, you don't create the lines separating each row
		if($r%2==0){
			$fill=0;
		}else{
			$fill=1;
		}
		if ($r==$startnum[$m]){
			$rowPositionY[$r] = $Y_Table_Position; 
		} else {
			$rowPositionY[$r] = $rowPositionY[$r-1] + $rowHeight[$r-1];
		}
		if($checkSeries[$m]){
			if(($r==0)||($series[$r]<>$series[$r-1]&&$r<>0)){
				$pdf->SetY($rowPositionY[$r]);
				$pdf->SetFillColor(255,255,255);
				$pdf->MultiCell(190,6,'',1,'',$fill);
				$rowPositionY[$r] = $rowPositionY[$r] + 6;
			}
		}
		$pdf->SetFillColor(230,230,230);
		$pdf->SetY($rowPositionY[$r]);
		for($j=0; $j<count($headerContent[$m]['ratio']); $j++){
			$pdf->SetY($rowPositionY[$r]);
			$pdf->SetX($columnPositionX[$m][$j]);
			$pdf->MultiCell($columnWidth[$m][$j],$rowHeight[$r],'',1,'',$fill);
		}
	}
	
	//**********************************************
	// STEP 3. FILL TABLE WITH TEXT
	//**********************************************
	for ($r=$startnum[$m]; $r<$endnum[$m];$r++){
		$pdf->SetFillColor(230,230,230);
		if ($r==$startnum[$m]){
			$rowPositionY[$r] = $Y_Table_Position; 
		} else {
			$rowPositionY[$r] = $rowPositionY[$r-1] + $rowHeight[$r-1];
		}
		if($checkSeries[$m]){
			if(($r==0)||($series[$r]<>$series[$r-1]&&$r<>0)){
				$sr=$series[$r];
				$pdf->SetFont('uni','B',10);
				$pdf->SetY($rowPositionY[$r]);
				$pdf->MultiCell(0,6,"$sr",0,'L');  // SAME AS CELL() BUT CONTENT INSIDE CAN BE MORE THEN 1 LINE
				$rowPositionY[$r] = $rowPositionY[$r] + 6;
			}
		}
		// -------------------------------------------------------------
		//------------- DISPLAY CONTENT OF EACH CELL OF THE ROW -----------
		$pdf->SetFont('uni','B',9);
		for($j=0; $j<count($headerContent[$m]['ratio']); $j++){
			$trc = $thisRowContent[$m][$r][$j];
			$pdf->SetY($rowPositionY[$r]);
			$pdf->SetX($columnPositionX[$m][$j]);
			$pdf->MultiCell($columnWidth[$m][$j],CONSTANT_LINE_HEIGHT,"$trc",0,$alignment[$m][$r][$j]);
		}
		//------------- END OF DISPLAY CONTENT OF EACH CELL OF THE ROW -----------
		// -------------------------------------------------------------
	}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.