Text
Text object.
Object for holding arbitrary text information.
Text Declaration
text declare text object.
To declare a text object, use the keyword text, followed by the object name:
text mytext
Text Views
display display table, graph, or spool in object window.
label label information for the text object.
text view contents of text object.
Text Procs
append appends text to the end of a text object.
clear clear a text object.
clearhist clear the contents of the history attribute.
copy creates a copy of the text.
displayname changes the display name for the text object.
olepush push updates to OLE linked objects in open applications.
save save text object to disk as an ASCII text, RTF, HTML, PDF, TEX, or Markdown file.
setattr set the value of an object attribute.
svector make svector out of the contents of the text object.
Text Data Members
Scalar Values
@linecount scalar containing the number of lines in a Text object.
String values
@attr("arg") string containing the value of the arg attribute, where the argument is specified as a quoted string.
@description string containing the Text object’s description (if available).
@detailedtype string with the object type: “TEXT”.
@displayname string containing the Text object’s display name. If the object has no display name set, the name is returned.
@line(i) returns a string containing the Text on i-th line of the Text object.
@name string containing the Text object’s name.
@remarks string containing the Text object’s remarks (if available).
@svector returns an Svector where each element is a line of the Text object.
@svectornb same as @svector, with blank lines removed.
@type string with the object type: “TEXT”.
@updatetime string representation of the time and date at which the Text object was last updated.
Text Examples
text mytext
[add text to the object]
mytext.text
Appends text or a text file to the end of a text object.
There are different forms of the command, with the syntax depending on whether you are appending a line of text or the contents of a text file to the end of the text object.
Syntax
text_name.append“text to append”
text_name.append(file) [path\]file_name
Specify the literal text or file name after the append keyword.
Examples
tt1.append "Add this to the end"
appends the text “Add this to the end” at the end of the text object TT1.
To include quotes in the string, use the quote escape sequence, or double quotes:
tt1.append """This is a quoted string"""
appends “This is a quoted string”.
You may also use curly braces with a string object:
string s = """This is a quoted string"""
tt1.append {s}
appends “This is a quoted string”.
tt1.append(file) c:\myfile\file.txt
appends the contents of the text file “File.TXT” to the text object.
Cross-references
Clear a text object.
Syntax
text_name.clear
Examples
The following command clears all text from the text object TT1:
tt1.clear
Cross-references
Clear the contents of the history attribute for text objects.
Removes the text’s history attribute, as shown in the label view of the text.
Syntax
text_name.clearhist
Examples
t1.clearhist
t1.label
The first line removes the history from the text T1, and the second line displays the label view of T1, including the now blank history field.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names.
Clear the contents of the remarks attribute.
Removes the text’s remarks attribute, as shown in the label view of the text.
Syntax
text_name.clearremarks
Examples
t1.clearremarks
t1.label
The first line removes the remarks from the text T1, and the second line displays the label view of T1, including the now blank remarks field.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names.
Creates a copy of the text.
Creates either a named or unnamed copy of the text.
Syntax
text_name.copy
text_name.copy dest_name
Examples
t1.copy
creates an unnamed copy of the text T1.
t1.copy t2
creates T2, a copy of the text T1.
Cross-references
Display table, graph, or spool output in the text object window.
Display the contents of a table, graph, or spool in the window of the text object.
Syntax
text_name.display object_name
Examples
text1.display tab1
Display the contents of the table TAB1 in the window of the object TEXT1.
Cross-references
Most often used in constructing an EViews Add-in. See
“Custom Object Output”.
Display name for text objects.
Attaches a display name to a text object which may be used in place of the standard text object name.
Syntax
text_name.displayname display_name
Display names are case-sensitive, and may contain a variety of characters, such as spaces, that are not allowed in text object names.
Examples
hrs.displayname Hours Worked
hrs.label
The first line attaches a display name “Hours Worked” to the text object HRS, and the second line displays the label view of HRS, including its display name.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names.
Display or change the label view of the text object, including the last modified date and display name (if any).
As a procedure, label changes the fields in the text object label.
Syntax
text_name.label
text_name.label(options) [text]
Options
The first version of the command displays the label view of the text object. The second version may be used to modify the label. Specify one of the following options along with optional text. If there is no text provided, the specified field will be cleared.
c | Clears all text fields in the label. |
d | Sets the description field to text. |
s | Sets the source field to text. |
u | Sets the units field to text. |
r | Appends text to the remarks field as an additional line. |
p | Print the label view. |
Examples
The following lines replace the remarks field of the text object LWAGE with “Data from CPS 1988 March File”:
lwage.label(r)
lwage.label(r) Data from CPS 1988 March File
To append additional remarks to LWAGE, and then to print the label view:
lwage.label(r) Log of hourly wage
lwage.label(p)
To clear and then set the units field, use:
lwage.label(u) Millions of bushels
Cross-references
See
“Labeling Objects” for a discussion of labels.
Push updates to OLE linked objects in open applications.
Syntax
text_name.olepush
Cross-references
See
“Object Linking and Embedding (OLE)” for a discussion of using OLE with EViews.
Save text object to disk as an ASCII text, RTF, HTML, PDF, TEX, or MD file.
Syntax
text_name.save(options) [path\]file_name
Follow the keyword with a name for the file. file_name may include the file type extension, or the file type may be specified using the “t=” option.
If an explicit path is not specified, the file will be stored in the default directory, as set in the global options.
The MD (Markdown) setting uses very basic syntax and should be usable in most editors.
Options
t=file_type (default= “txt”) | Specifies the file type, where file_type may be one of: “rtf” (Rich-text format), “txt” (ASCII text), or “html” (HTML - Hypertext Markup Language), “pdf” (Portable Document Format, PDF), “tex” (LaTeX), or “md” (Markdown). Files will be saved with the “.rtf”, “.txt”, “html”, “pdf”, “tex”, or “md” extensions, respectively. |
dropempty | Removes empty lines from output (empty lines are included by default). |
Examples
The command:
text1.save mytext
saves TEXT1 to an ASCII text file named “MYTEXT.TXT” in the default directory.
text1.save mytext.bat
saves TEXT1 to an ASCII text file using the explicitly provided name “MYTEXT.BAT”.
text1.save(t=rtf, dropempty) mytext
saves TEXT1 (excluding any empty lines) to the RTF file “MYTEXT.RTF”.
Cross-references
See
“Table and Text Objects” for a discussion of tables.
Set the object attribute.
Syntax
text_name.setattr(attr) attr_value
Sets the attribute attr to attr_value. Note that quoting the arguments may be required. Once added to an object, the attribute may be extracted using the @attr data member.
Examples
a.setattr(revised) never
String s = a.@attr("revised")
sets the “revised” attribute in the object A to the string “never”, and extracts the attribute into the string object S.
Cross-references
Make an svector out of the contents of the text object.
Syntax
text_name.svector name
Makes an svector called name, where each row of the svector is equal to a line of the text object.
Examples
text01.svector svec
makes an svector named SVEC.
Cross-references
See
“String Vectors” for a discussion of strings and string vector. See also
“Svector”.
Declare a text object when used as a command, or display text representation of the text object.
Syntax
text object_name
text_name.text(options)
When used as a command to declare a table object, follow the keyword with a name of the text object.
Options
p | Print the model text specification. |
Examples
text notes1
declares a text object named NOTES1.
Cross-references
See
“Text Objects” for a discussion of text objects in EViews.