Setting HTML Attributes Under -PRINTER:EH

In certain cases, you may want additional control over the enhanced HTML code that is generated with -PRINTER:EH. SQR supports extensions that enable you to control the generated HTML by specifying titles, background colors and images, links, text colors, and more.

Specifying HTML Titles

The HTML page title normally appears on the caption bar of the browser window and is also used when you are creating a bookmark for the page. It is placed between the <TITLE> and </TITLE> HTML tags. Specify the title of the HTML page by using the %%Title extension at the beginning of the SQR program by entering:

Print-Direct Printer=html '%%Title Monthly Sales'

Specifying Background Colors

Specify a background color for the pages that are generated with -PRINTER:EH by using the %%Body-BgColor extension. Enter code like this at the beginning of the program:

Print-Direct Printer=html '%%Body-BgColor #0000FF'

To set the background color for the navigation bar, enter code like this:

Print-Direct Printer=html '%%Nav-Body-BgColor #0000FF'

See “Specifying HTML Colors.”

Specifying Background Images

To use a background image for the report pages that the enhanced HTML generates, insert the %%Background extension at the beginning of the program:

Print-Direct Printer=html '%%Background tile.gif'

To set the background image for the navigation bar, enter code like this:

Print-Direct Printer=html '%%Nav-Background D:\jpegdir\house.jpg'

The background attribute can be any valid URL. If you do not specify the %%Nav-Background extension while specifying the body background, the background image that you specify for the body is used both in the body and in the navigation bar. If you do not want an image to appear in the navigation bar, use code like this:

Print-Direct printer=html '%%Nav-Background EMPTY'

Specifying Links

The %%Href extension specifies a link in the report. This extension enables you to make a text, number, image, or chart object into a link. The object can be the item that you click to activate the link or it can be the location on the page where the link takes you. Specify the latter by using the %%Anchor extension. For example:

Print-Direct Printer=html '%%Href #section2'
Print 'ABC' ()
...
Print-Direct Printer=html '%%Anchor section2'
Print 'XYZ' ()

In this example, clicking the ABC text on the page jumps to the XYZ text. When using frames or multiple browser windows, you can control which frame displays the target of the link by using the target option of the %%Href extension. For example, specify on one line:

Print-Direct Printer=html '%%Href target="_top" http://www.example.com'

Specifying Text Colors

Use the %%Color and %%ResetColor extensions to change the color of text. The following code example demonstrates this capability:

If &Salary > 100000
Print-Direct Printer=html '%%Color #FF0000'
End-If
Print &Salary ()
If &Salary > 100000
Print-Direct Printer=html '%%ResetColor'
End-If

In this example, when the value of the column is more than 100,000, it prints in red. The %%Color extension affects all text (and number) printing from this point on. This behavior is similar to that of the ALTER-PRINTER command. A subsequent invocation of %%Color with a different color value sets the current color to a new color. To restore the color to the default (normally, black) use the %%ResetColor extension.

Specifying HTML Colors

Specifying color as a red-green-blue (RGB) hexadecimal value is the only way to designate color in SQR. Your browser documentation should contain a listing of supported colors and their hexadecimal values. To specify color as an RGB hexadecimal value, enter a # character followed by six hexadecimal digits. The first two digits specify the intensity of the red, the next two specify the green, and the last two specify the blue. For example, green is #00FF00.

Including Your Own HTML Tags

Enhanced HTML extensions enable you to include your own HTML tags in the output. These tags are passed through to the output without change. Use this feature to include advanced HTML capabilities such as JavaScript and <APPLET> tags.

SQR PRINT with CODE-PRINTER=HT enables you to inject any text into the HTML output. SQR does not check the text that you are printing. This text can contain anything that your browser understands. Do not use this method for formatting, because your formatting may conflict with -PRINTER:EH-enhanced HTML formatting. -PRINTER:EH-enhanced HTML uses HTML tables extensively. To fully control the formatting, use the HTML procedures that are defined in html.inc and that are documented in this section. By invoking the html_on procedure, you instruct the enhanced HTML to perform no formatting. Specify all formatting by using the HTML procedures in html.inc or by using SQR PRINT with CODE-PRINTER=HT to insert HTML code. When you use SQR PRINT with CODE-PRINTER=HT, the enhanced HTML does not translate special symbols that are used in HTML tags, such as <, >, and &.