{{sidenavigation.sidenavigationExpandLabel}}
{{getMsg('Help_YouAreHere')}}: {{page.title}} {{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}} {{helpModel.downloadHelpPdfDataStatus}}

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.

To prevent security issues with uploaded report templates, this function is limited. A non-administrative user can use it only for:

  • valid report locations if enabled
  • if the specified file comes from the file system, then it must be from the same directory or subdirectory as the report itself
  • both, rpt file and specified file need to use the same protocol (e.g. file protocol)

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
i-net Clear Reports
This application uses cookies to allow login. By continuing to use this application, you agree to the use of cookies.


Help - TextFromFile