Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter ElevenSGML Functions (continued)

11.10 The HTML Writer Object

11.10.1 General

The HTML Writer Object provides a simple facility for creating HTML data in the form of a file or string. The object has the ability to create portions or a complete HTML document. The object relieves the programmer of the task of tracking and creating HTML and CSS code.

From a programmer’s perspective, the object provides that ability to easily add paragraphs and tables. In addition, straight HTML code can also be added to the result.

By default, it is assumed that raw text is being added and the text will be encoded into PCDATA (ampersands, less-than and greater-than symbols encoded). However, this can be overridden to allow straight text to be added. The HTMLSetTextMode function controls the method of adding text.

11.10.2 Basic Operation

The object breaks into five basic categories: object control, HTML header and footer, paragraph (or block) operations, basic text operations and table operations.

Object control includes the creation and management of the object and writing the result to a string or a file. The HTMLCreateWriterObject function is used to create the HTML Writer Object and returns a handle that is used to later reference the object. When data set creation is complete, the HTMLWriterToFile or HTMLWriterToString function can be used to copy the data. When the object is no long needed, use the CloseHandle function to release the handle.

An HTML envelope is option. If the resulting HTML will be used as the final file, then it should normally contain the HTML wrapper, heading and any other items normally placed at the beginning of the data stream. However, if the HTML being created is to be inserted as part of the larger data set, then the wrapper is optional. Prior to adding the HTML header, the [HTMLAddStyleSheet] and HTMLSetDTD can be used to add a style sheet or to specify the underlying HTML DTD. When ready to open the HTML body, the HTMLAddHead function is called and the heading code is added to the HTML data set. Upon completion of writing the body of the data, the HTMLAddFoot is called and the ending HTML tags are added to the data set.

Paragraph functions allow the addition of basic paragraphs either as an entire chunk of text using the HTMLAddPara function or by opening the paragraph with the HTMLParaOpen function, writing data using HTMLAddText function, and then closing the paragraph with the HTMLParaClose function. The style of the paragraph can be controlled using the HTMLSetBlockClass and HTMLSetBlockStyle functions.

Table operations allow the addition of a complete table or assembly by rows and cells.

11.10.3 HTML Writer Object Functions