Class RTF::Document
In: lib/rtf/node.rb
Parent: CommandNode

This class represents an RTF document. In actuality it is just a specialised Node type that cannot be assigned a parent and that holds document font, colour and information tables.

Methods

Constants

CS_ANSI = :ansi   A definition for a document character set setting.
CS_MAC = :mac   A definition for a document character set setting.
CS_PC = :pc   A definition for a document character set setting.
CS_PCA = :pca   A definition for a document character set setting.
LC_AFRIKAANS = 1078   A definition for a document language setting.
LC_ARABIC = 1025   A definition for a document language setting.
LC_CATALAN = 1027   A definition for a document language setting.
LC_CHINESE_TRADITIONAL = 1028   A definition for a document language setting.
LC_CHINESE_SIMPLIFIED = 2052   A definition for a document language setting.
LC_CZECH = 1029   A definition for a document language setting.
LC_DANISH = 1030   A definition for a document language setting.
LC_DUTCH = 1043   A definition for a document language setting.
LC_DUTCH_BELGIAN = 2067   A definition for a document language setting.
LC_ENGLISH_UK = 2057   A definition for a document language setting.
LC_ENGLISH_US = 1033   A definition for a document language setting.
LC_FINNISH = 1035   A definition for a document language setting.
LC_FRENCH = 1036   A definition for a document language setting.
LC_FRENCH_BELGIAN = 2060   A definition for a document language setting.
LC_FRENCH_CANADIAN = 3084   A definition for a document language setting.
LC_FRENCH_SWISS = 4108   A definition for a document language setting.
LC_GERMAN = 1031   A definition for a document language setting.
LC_GERMAN_SWISS = 2055   A definition for a document language setting.
LC_GREEK = 1032   A definition for a document language setting.
LC_HEBREW = 1037   A definition for a document language setting.
LC_HUNGARIAN = 1038   A definition for a document language setting.
LC_ICELANDIC = 1039   A definition for a document language setting.
LC_INDONESIAN = 1057   A definition for a document language setting.
LC_ITALIAN = 1040   A definition for a document language setting.
LC_JAPANESE = 1041   A definition for a document language setting.
LC_KOREAN = 1042   A definition for a document language setting.
LC_NORWEGIAN_BOKMAL = 1044   A definition for a document language setting.
LC_NORWEGIAN_NYNORSK = 2068   A definition for a document language setting.
LC_POLISH = 1045   A definition for a document language setting.
LC_PORTUGUESE = 2070   A definition for a document language setting.
LC_POTUGUESE_BRAZILIAN = 1046   A definition for a document language setting.
LC_ROMANIAN = 1048   A definition for a document language setting.
LC_RUSSIAN = 1049   A definition for a document language setting.
LC_SERBO_CROATIAN_CYRILLIC = 2074   A definition for a document language setting.
LC_SERBO_CROATIAN_LATIN = 1050   A definition for a document language setting.
LC_SLOVAK = 1051   A definition for a document language setting.
LC_SPANISH_CASTILLIAN = 1034   A definition for a document language setting.
LC_SPANISH_MEXICAN = 2058   A definition for a document language setting.
LC_SWAHILI = 1089   A definition for a document language setting.
LC_SWEDISH = 1053   A definition for a document language setting.
LC_THAI = 1054   A definition for a document language setting.
LC_TURKISH = 1055   A definition for a document language setting.
LC_UNKNOWN = 1024   A definition for a document language setting.
LC_VIETNAMESE = 1066   A definition for a document language setting.

Attributes

character_set  [W]  Attribute mutator.
character_set  [R]  Attribute accessor.
colours  [R]  Attribute accessor.
fonts  [R]  Attribute accessor.
information  [R]  Attribute accessor.
language  [R]  Attribute accessor.
language  [W]  Attribute mutator.
style  [R]  Attribute accessor.

Public Class methods

This is a constructor for the Document class.

Parameters

font:The default font to be used by the document.
style:The style settings to be applied to the document. This defaults to nil.
character:The character set to be applied to the document. This defaults to Document::CS_ANSI.
language:The language setting to be applied to document. This defaults to Document::LC_ENGLISH_UK.

Public Instance methods

This method fetches the height of the available work area space for a a typical Document object page.

This method fetches the width of the available work area space for a typical Document object page.

Attribute accessor.

Attribute mutator.

Parameters

font:The new default font for the Document object.

This method fetches a footer from a Document object.

Parameters

type:One of the footer types defined in the footer class. Defaults to FooterNode::UNIVERSAL.

This method assigns a new footer to a document. A Document object can have up to four footers - a default footer, a footer for left pages, a footer for right pages and a footer for the first page. The method checks the footer type and stores it appropriately.

Parameters

footer:A reference to the footer object to be stored. Existing footer objects are overwritten.

This method provides a method that can be called to generate an identifier that is unique within the document.

This method fetches a header from a Document object.

Parameters

type:One of the header types defined in the header class. Defaults to HeaderNode::UNIVERSAL.

This method assigns a new header to a document. A Document object can have up to four header - a default header, a header for left pages, a header for right pages and a header for the first page. The method checks the header type and stores it appropriately.

Parameters

header:A reference to the header object to be stored. Existing header objects are overwritten.

This method inserts a page break into a document.

This method provides a short cut for obtaining the Paper object associated with a Document object.

This method overrides the parent=() method inherited from the CommandNode class to disallow setting a parent on a Document object.

Parameters

parent:A reference to the new parent node for the Document object.

Exceptions

RTFError:Generated whenever this method is called.

This method generates the RTF text for a Document object.

[Validate]