Main Content

Import File

Import ASCII text file into report

Description

This component imports an ASCII text file into the report.

Properties

  • File name: Specifies the name of the file to import into the text field. You can enter a name, or use the Browse button (...) to find the file.

    To use a MATLAB® workspace variable in a path name, use the notation %<VariableName>. Examples:

    • %<doc>

    • %<dir>/%<doc>

    • %<[dir,'/filename.txt']>

    • %<dir>/filename.txt

  • Import file as: Specifies formatting for the imported file. Options include:

    • Plain text (ignore line breaks): Imports the file as plain text without any line breaks (no paragraphs). If you select this option, the Import File component acts like the Text component, so it should have the Paragraph component as its parent.

      The examples in this section use the following text as the input file:

      This is the first row of text from the imported file.
      The second row follows a line break in the first row.
      
      There is a blank line above the third row.
      

      Plain text (ignore line breaks) produces the following formatting for the example file:

      This is the first row of text from the imported file. 
      The second row follows a line break in the first row. 
      
      There is a blank line above the third row.
      
    • Paragraphs defined by line breaks: Imports the file as text, in paragraphs with line breaks (hard returns or carriage returns). This option produces the following formatting for the example file:

      This is the first row of text from the imported file.
      The second row follows a line break in the first row.
      
      There is a blank line above the third row.
      

    • Paragraphs defined by empty rows: Imports the file as text, in paragraphs with empty rows (rows that include no text). This option produces the following formatting for the example file:

      This is the first row of text from the imported file. 
      The second row follows a line break in the first row.
      
      There is a blank line above the third row.
      

    • Text (retain line breaks) (default): Imports the file as plain text with line breaks. This option produces the following formatting for the example file:

      This is the first row of text from the imported file.
      The second row follows a line break in the first row.
      
      There is a blank line above the third row.
      

    • Fixed-width text (retain line breaks): Imports the file as fixed-width text (all letters have the same width or size), including line breaks. This option is useful for importing MATLAB files. This option produces the following formatting for the example file:

      This is the first row of text from the imported file. 
      The second row follows a line break in the first row.
      
      There is a blank line above the third row.
      

    • DocBook XML: Inserts an XML source file, and makes no changes to its format.

    • Formatted Text (HTML/RTF): Inserts an RTF or HTML source file, and makes no changes to its format.

    • Syntax highlighted MATLAB code: Inserts a MATLAB file.

    The File Contents field displays the first few lines of the file to be imported.

Insert Anything into Report?

Yes.

  • Inserts text if you select one of the following options:

    • Plain text (ignore line breaks)

    • Text (retain line breaks)

    • Fixed-width text (retain line breaks)

  • Inserts paragraphs if you select one of the following options:

    • Paragraphs defined by line breaks

    • Paragraphs defined by empty rows

  • Inserts the contents of an XML file if you select the DocBook XML option.

  • Inserts the contents of the RTF or HTML file if you select the Formatted text (HTML/RTF) option.

  • Inserts a link to a file if you import the file into an HTML report.

Class

rptgen.crg_import_file