Script functions reference > Script functions in alphabetical order > G > GetTextFormattingInfo

GetTextFormattingInfo
Syntax
GetTextFormattingInfo(base, lxf_data, width, height);
Description
Enables splitting of LXF text into separate areas, for example to create multi-column output. The LXF text must be comply with the Advanced Text functionality in PageOUT.
The function returns variables with values specifying:
Returns
$base_text
A string in LXF format that represents text that fits into the specified area (height/width arguments)
$base_width
The width of the $base_text string.
$base_height
The height of the $base_text string.
$base_rows
$base_next
A string in LXF format that does not fit into the specified area and can be used in the next area.
$base_next_width
$base_next_height
$base_next_rows
0
Example
$file = "data/overlays/fragment.lxf";
// load the LXF fragment into variable
$err = FileOpen( $file, "r" );
$part = 0;
if(num($err) = 0)
{ 
  $lxf = "";
  $line = "";
  	while( 0 = FileReadLn( $file, $line ) )
  	{ 		
    $lxf = $lxf + $line;
  		  $lxf = $lxf + "<0D><0A>";
  	}
  	FileClose( $file );
	
  $test_width = 50;
  	$test_height = 60;
	
  // write test output, original
  	$filename = "data/overlays/fragment.part." + $part + ".lxf";
  	fileopen($filename, "wb" );
  	filewrite($filename,$lxf);
  	fileclose($filename);
  	$part++;
 
	  GetTextFormattingInfo( "test", $lxf, $test_width, $test_height );
	  
  // write test output, part 1
  	$testfile = "data/overlays/fragment.part." + $part + ".lxf";
  	fileopen($testfile, "wb" );
  	filewrite($testfile,$test_text);
  	fileclose($testfile);
  	$part++;	 
//write test output, part 2
  	$testfile = "data/overlays/fragment.part." + $part + ".lxf";
  	fileopen($testfile, "wb" );
  	filewrite($testfile,$test_next);
  	fileclose($testfile);
  	$part++;
	  log(0, "variable: test_width: " + $test_width );
  	log(0, "variable: test_height: " + $test_height );
  	log(0, "variable: test_rows: " + $test_rows );
	  log(0, " " );
  	log(0, "variable: test_next_width: " + $test_next_width );
  	log(0, "variable: test_next_height: " + $test_next_height );
  	log(0, "variable: test_next_rows: " + $test_next_rows );
 
  	fileclose( $file );
}
else
{ $errtext=ioerrtext($err);
         log(0,"Could not open " + $file + ": " + $errtext);
}	
OpenText StreamServe 5.6 Updated: 2013-03-01