Basic Syntax CrystalClear Syntax Before Reading Records

TextFromFile( String )
TextFromFile( String, String )


Reads a file from the specified path (in the format "C:\folder\file.txt") and returns it as a string. Slashes and backslashes are both fine in the path name, so long as they are used consistently. The file path must be the absolute file path, not a relative path to the report location or the i-net Clear Reports installation folder.

The second parameter is optional, and is the codepage to be used for reading the text file. The name should be the Java name for the codepage. Examples of names would be: "UTF8", "UTF16", "ASCII", "Unicode", "UnicodeBig", "UnicodeLittle", "Cp1252" (Western European), "Cp1251" (Cyrillic), "Big5", "GB18030", "ISO8859_1"

If the file does not exist or cannot be read, this will show an error. Also note that if you specify an RTF or HTML formatted file, you should take advantage of the HTML or RTF Text Interpretation of text elements.

Usage:

textFromFile( String )
textFromFile( String, String )

Return:

String value

Example:

textFromFile("C:/test.txt")  	// returns content of the file text.txt as text
textFromFile("C:/test.txt", "ASCII" )  	// returns content of the file text.txt, decoded as ASCII
textFromFile("/home/usr/test.html")	// returns the HTML code in the file test.html

See also:


i-net software strives to provide accurate product documentation. Please give us your feedback using the form below.
NOTE: This form is for documentation feedback only. For technical assistance, please send an email to crystalclear@inetsoftware.de.

This page is: very poor very good
Comment: