Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter FifteenWindows/OS Functions (continued)

ClipboardSetHTML Function

Overview

The ClipboardSetHTML sets HTML code onto the Windows clipboard via a Clipboard Object.

Syntax/Parameters

Syntax

int = ClipboardSetHTML ( handle hClipboard, string data | handle hPool, [boolean raw] );

int = ClipboardSetHTML ( handle hClipboard, string data | handle hPool,
                                       [string header], [string footer] );

Parameters

hClipboard

A handle to a Clipboard Object.

data

A string containing text to place on the clipboard or,

hPool

A handle to a String Pool Object containing the text to place on the clipboard.

raw

An optional boolean flag indicating that the data parameter is raw information to post on the clipboard. When set, the data must contain a Windows HTML clipboard prefix. If the flag is omitted, it is assumed that an optional header and footer are applied to the data and the prefix will automatically be added. See Remarks for more information.

header

An optional string specifying an HTML header for the HTML code. This is the code from the <!DOCTYPE> and <HTML> tag to the <BODY> tag. If omitted, a default header will be added.

footer

An optional string specifying an HTML footer for the HTML code. This is the code trailing the HTML which is normally </BODY> </HTML>. If omitted, a default footer will be added.

Return Value

Returns an int value as ERROR_NONE or a formatted error code.

Remarks

The function places data on the clipboard using the HTML designator as 8-bit ANSI text. The Clipboard Object must first be created using the ClipboardCreate function.

Windows HTML is not a standard format. If the de facto HTML type is not registered, the ClipboardSetHTML function will automatically register the clipboard format.

HTML posted on the Windows clipboard must be formatted in a particular way. It must contain a prefix and then code. The prefix contains a number of offsets to absolute character positions in the HTML data. In raw mode, it is expected that the data parameter contains properly formatted and indexed data. Otherwise, the prefix is created by the function.

The coding is expected to be a complete well formed HTML document. Therefore, even a small chunk of HTML must be an HTML header and footer. The prefix specifies to the consumer of the clipboard data where the sniglet code of interest is located.

An example prefix (does not contain all the options):

Version:1.0
StartHTML:000123
EndHTML:009999
StartFragment:000200
EndFragment:009900
StartSelection:000200
EndSelection:009900

When the raw HTML data is read, the parameters tell the reader where the entire HTML starts and stops, where the fragment starts and where the selected information starts. Within the HTML, it is not uncommon to have comments that indicate the beginning and end of sections. For example:

<!--StartFragment-->

    . . .

<!--EndFragment-->

To post both HTML and text, create a clipboard and call ClipboardSetText and then the ClipboardSetHTML function. It is advisable to provide a text version of the HTML, even if the formatted is less than optimal.

If a default header is used (not raw), it is defined as HTML 5. The encoding is not set and as such the content is assumed to be ASCII..

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic