Creating Styles

Styles are defined in Stylesheets. Stylesheets are functions that return the style settings for a given class name. In this topic, we will cover adding new styles to an existing stylesheet. Creating new stylesheets is covered separately.

To add a new style to an existing stylesheet, we just need to create an extension to the stylesheet function and add clauses to it that define the new styles. See Extending Object Definitions for information about extending functions.

In this example, we will add a new class name and extend the Standard stylesheet to include a definition for the new style. The steps are:

  1. Create a new Object Module in either the current document or in a library.
  2. In that module, create the StyleSheets namespace and create an object definition for the new class. In this example, we will use MyAddedClass. The MyAddedClass object should be typed as ClassName.
  3. Create an extension for the standard stylesheet function. This function is called StandardStyleSheet. The type for this object needs to be ClassNameStyle.
  4. Add a clause for MyAddedClass to the extension of StandardStyleSheet. At this point your new Object Module should look something like:

The new style will only be available in the current document if the new Object Module is in the current document. If the new module is in a library, the new style will be available in any document that references the library.