Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
Untitled diff
Created
11 years ago
Diff never expires
Clear
Export
Share
Explain
38 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
112 lines
Copy
23 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
91 lines
Copy
Copy
Copied
Copy
Copied
function
MultiCell
($w, $h, $txt, $border=
0
, $align='J'
, $fill=false)
function
Get
MultiCell
Height
($w, $h, $txt, $border=
null
, $align='J'
)
{
{
//
Calculate MultiCell
with automatic or explicit line breaks
height
//
Output text
with automatic or explicit line breaks
// $border is un-used, but I kept it in the parameters to keep the call
// to this function consistent with MultiCell()
$cw = &$this->CurrentFont['cw'];
$cw = &$this->CurrentFont['cw'];
if($w==0)
if($w==0)
$w = $this->w-$this->rMargin-$this->x;
$w = $this->w-$this->rMargin-$this->x;
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
$s = str_replace("\r",'',$txt);
$s = str_replace("\r",'',$txt);
$nb = strlen($s);
$nb = strlen($s);
if($nb>0 && $s[$nb-1]=="\n")
if($nb>0 && $s[$nb-1]=="\n")
$nb--;
$nb--;
Copy
Copied
Copy
Copied
$b = 0;
if($border)
{
if($border==1)
{
$border = 'LTRB';
$b = 'LRT';
$b2 = 'LR';
}
else
{
$b2 = '';
if(strpos($border,'L')!==false)
$b2 .= 'L';
if(strpos($border,'R')!==false)
$b2 .= 'R';
$b = (strpos($border,'T')!==false) ? $b2.'T' : $b2;
}
}
$sep = -1;
$sep = -1;
$i = 0;
$i = 0;
$j = 0;
$j = 0;
$l = 0;
$l = 0;
$ns = 0;
$ns = 0;
Copy
Copied
Copy
Copied
$
nl
=
1
;
$
height
=
0
;
while($i<$nb)
while($i<$nb)
{
{
// Get next character
// Get next character
$c = $s[$i];
$c = $s[$i];
if($c=="\n")
if($c=="\n")
{
{
// Explicit line break
// Explicit line break
if($this->ws>0)
if($this->ws>0)
{
{
$this->ws = 0;
$this->ws = 0;
$this->_out('0 Tw');
$this->_out('0 Tw');
}
}
Copy
Copied
Copy
Copied
$
this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill)
;
//Increase Height
$
height += $h
;
$i++;
$i++;
$sep = -1;
$sep = -1;
$j = $i;
$j = $i;
$l = 0;
$l = 0;
$ns = 0;
$ns = 0;
Copy
Copied
Copy
Copied
$nl++;
if($border && $nl==2)
$b = $b2;
continue;
continue;
}
}
if($c==' ')
if($c==' ')
{
{
$sep = $i;
$sep = $i;
$ls = $l;
$ls = $l;
$ns++;
$ns++;
}
}
$l += $cw[$c];
$l += $cw[$c];
if($l>$wmax)
if($l>$wmax)
{
{
// Automatic line break
// Automatic line break
if($sep==-1)
if($sep==-1)
{
{
if($i==$j)
if($i==$j)
$i++;
$i++;
if($this->ws>0)
if($this->ws>0)
{
{
$this->ws = 0;
$this->ws = 0;
$this->_out('0 Tw');
$this->_out('0 Tw');
}
}
Copy
Copied
Copy
Copied
$
this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill)
;
//Increase Height
$
height += $h
;
}
}
else
else
{
{
if($align=='J')
if($align=='J')
{
{
$this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
$this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
$this->_out(sprintf('%.3F Tw',$this->ws*$this->k));
$this->_out(sprintf('%.3F Tw',$this->ws*$this->k));
}
}
Copy
Copied
Copy
Copied
$this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill)
;
//Increase Height
$height += $h
;
$i = $sep+1;
$i = $sep+1;
}
}
$sep = -1;
$sep = -1;
$j = $i;
$j = $i;
$l = 0;
$l = 0;
$ns = 0;
$ns = 0;
Copy
Copied
Copy
Copied
$nl++;
if($border && $nl==2)
$b = $b2;
}
}
else
else
$i++;
$i++;
}
}
// Last chunk
// Last chunk
if($this->ws>0)
if($this->ws>0)
{
{
$this->ws = 0;
$this->ws = 0;
$this->_out('0 Tw');
$this->_out('0 Tw');
}
}
Copy
Copied
Copy
Copied
if($border && strpos($border,'B')!==false)
//Increase Height
$b .= 'B';
$
height += $h
;
$
this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill)
;
$this->x = $this->lMargin
;
return $height
;
}
}
Saved diffs
Original text
Open file
function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false) { // Output text with automatic or explicit line breaks $cw = &$this->CurrentFont['cw']; if($w==0) $w = $this->w-$this->rMargin-$this->x; $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; $s = str_replace("\r",'',$txt); $nb = strlen($s); if($nb>0 && $s[$nb-1]=="\n") $nb--; $b = 0; if($border) { if($border==1) { $border = 'LTRB'; $b = 'LRT'; $b2 = 'LR'; } else { $b2 = ''; if(strpos($border,'L')!==false) $b2 .= 'L'; if(strpos($border,'R')!==false) $b2 .= 'R'; $b = (strpos($border,'T')!==false) ? $b2.'T' : $b2; } } $sep = -1; $i = 0; $j = 0; $l = 0; $ns = 0; $nl = 1; while($i<$nb) { // Get next character $c = $s[$i]; if($c=="\n") { // Explicit line break if($this->ws>0) { $this->ws = 0; $this->_out('0 Tw'); } $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); $i++; $sep = -1; $j = $i; $l = 0; $ns = 0; $nl++; if($border && $nl==2) $b = $b2; continue; } if($c==' ') { $sep = $i; $ls = $l; $ns++; } $l += $cw[$c]; if($l>$wmax) { // Automatic line break if($sep==-1) { if($i==$j) $i++; if($this->ws>0) { $this->ws = 0; $this->_out('0 Tw'); } $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); } else { if($align=='J') { $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; $this->_out(sprintf('%.3F Tw',$this->ws*$this->k)); } $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); $i = $sep+1; } $sep = -1; $j = $i; $l = 0; $ns = 0; $nl++; if($border && $nl==2) $b = $b2; } else $i++; } // Last chunk if($this->ws>0) { $this->ws = 0; $this->_out('0 Tw'); } if($border && strpos($border,'B')!==false) $b .= 'B'; $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); $this->x = $this->lMargin; }
Changed text
Open file
function GetMultiCellHeight($w, $h, $txt, $border=null, $align='J') { // Calculate MultiCell with automatic or explicit line breaks height // $border is un-used, but I kept it in the parameters to keep the call // to this function consistent with MultiCell() $cw = &$this->CurrentFont['cw']; if($w==0) $w = $this->w-$this->rMargin-$this->x; $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; $s = str_replace("\r",'',$txt); $nb = strlen($s); if($nb>0 && $s[$nb-1]=="\n") $nb--; $sep = -1; $i = 0; $j = 0; $l = 0; $ns = 0; $height = 0; while($i<$nb) { // Get next character $c = $s[$i]; if($c=="\n") { // Explicit line break if($this->ws>0) { $this->ws = 0; $this->_out('0 Tw'); } //Increase Height $height += $h; $i++; $sep = -1; $j = $i; $l = 0; $ns = 0; continue; } if($c==' ') { $sep = $i; $ls = $l; $ns++; } $l += $cw[$c]; if($l>$wmax) { // Automatic line break if($sep==-1) { if($i==$j) $i++; if($this->ws>0) { $this->ws = 0; $this->_out('0 Tw'); } //Increase Height $height += $h; } else { if($align=='J') { $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; $this->_out(sprintf('%.3F Tw',$this->ws*$this->k)); } //Increase Height $height += $h; $i = $sep+1; } $sep = -1; $j = $i; $l = 0; $ns = 0; } else $i++; } // Last chunk if($this->ws>0) { $this->ws = 0; $this->_out('0 Tw'); } //Increase Height $height += $h; return $height; }
Find difference