{{getMsg('Help_YouAreHere')}}: {{page.title}} {{page.title}}

TextFromFile

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 can be an absolute file path, or a path that is relative to the report file location.

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 )

Returns:

String value

Examples:

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