Skip to main content
Version: Next

Style sheets

A style sheet is an object of defined set of attribute settings used to control the appearance of your 4D Write Pro documents. These settings can be applied to paragraphs and characters, such as the font to display, as well as the font's size, color, and weight. Once a style sheet is defined, it is saved as an object in the 4D Write Pro document so it can easily be reused. Style sheets let you give your documents a distinctive and unique appearance, while saving you time and effort.

Default style

All 4D Write Pro documents have a default paragraph style sheet, "Normal". New style sheets (created with the WP New style sheet command) automatically inherit from the Normal style. Attributes modified by a style sheet effect only the paragraphs they are applied to, the rest of the document retains the default Normal settings. If a style sheet is removed, the modified attributes will revert to the Normal style.

The Normal style defines a default value for every style sheet attribute in a 4D Write Pro document and can be retrieved with the WP Get style sheet command. The Normal style sheet can be modified (but not renamed) with the WP SET ATTRIBUTES command. While style sheets created with the WP New style sheet command can be deleted with the WP DELETE STYLE SHEET command, the Normal style sheet can not be deleted.

Paragraph and character style sheet attributes

Style sheets allow you to define the attributes of entire paragraphs or specific characters:

  • Paragraph - The vast majority of the attributes which can be modified apply only to paragraphs. Paragraph style sheets include character style settings, as well as formatting attributes that can only be applied at the paragraph level (e.g. margins, borders, tabs, etc.).
  • Character - Character style sheets use only the attributes appropriate for distinquishing text (one or more characters) from the paragraph style (e.g., headers, titles, underlined text, etc.).

Note that paragraph styles apply to whole paragraphs. To apply a style only to a specific part of a paragraph, you must use a character style sheet.

Style sheet precedence

Multiple paragraph and character style sheets can be combined within the same 4D Write Pro document. It's important to note style sheet precedence is determined by the order they are applied.

  • If you apply a paragraph style sheet and then apply a character style sheet, the character style sheet will take precedence over the paragraph style sheet. For example, you could apply a paragraph style sheet to the body of your document, then you could create a "bold" character style sheet and apply it to specific words. The paragraph style sheet will still apply to the rest of the text, however the character style sheet will be prioritized for the designated words.
  • If you apply a character style sheet and then apply a paragraph style sheet, the paragraph style sheet will be applied to all of the text and any character styles from the character style sheet will be removed.

Applying style sheets

Style sheets are applied with the WP SET ATTRIBUTES command using the wk style sheet or wk new line style sheet constants (or using object notation).

Retrieving style sheets

The WP Get style sheets command lets you retrieve all style sheets in a document according to their specific type. The WP Get style sheet command lets you retrieve a single style sheet by its name.

Importing and exporting style sheets

Because style sheets are stored as objects, they can easily be imported into other 4D Write Pro documents or maintained when exported in multiple formats.

Style sheet attributes

The following paragraph and character style sheet attributes can be modified with the WP SET ATTRIBUTES and WP RESET ATTRIBUTES commands, or retrieved with the WP GET ATTRIBUTES command.

note

Some attributes are linked together. Therefore when adding only one of these attributes, the other linked attributes will also be created with the default values. For linked attributes, the default value can be different than the value defined in the Normal style sheet. For example, if you define only a red left border, the other borders will be black (default value) even if the borders in the Normal style sheet were previously defined as purple.

AttributeParagraphCharacterLinked With
wk avoid widows and orphansX
wk background clipX
wk background colorXX
wk background heightXwk background width
wk background imageX
wk background image urlX
wk background originX
wk background position horizontalXwk background position vertical
wk background position verticalXwk background position horizontal
wk background repeatX
wk background widthXwk background height
wk border colorXwk border color bottom, wk border color left, wk border color right, wk border color top
wk border color bottomXwk border color, wk border color left, wk border color right, wk border color top
wk border color leftXwk border color, wk border color bottom, wk border color right, wk border color top
wk border color rightXwk border color, wk border color bottom, wk border color left, wk border color top
wk border color topXwk border color, wk border color bottom, wk border color left, wk border color right
wk border radiusX
wk border styleXwk border style bottom, wk border style left, wk border style right, wk border style top
wk border style bottomXwk border style, wk border style left, wk border style right, wk border style top
wk border style leftXwk border style, wk border style bottom, wk border style right, wk border style top
wk border style rightXwk border style, wk border style bottom, wk border style left, wk border style top
wk border style topXwk border style, wk border style bottom, wk border style left
wk border widthXwk border width bottom, wk border width left, wk border width right, wk border width top
wk border width bottomXwk border width, wk border width left, wk border width right, wk border width top
wk border width leftXwk border width, wk border width bottom, wk border width right, wk border width top
wk border width rightXwk border width, wk border width bottom, wk border width left, wk border width top
wk border width topXwk border width, wk border width bottom, wk border width left, wk border width right
wk directionX
wk fontXXwk font bold, wk font italic, wk font size
wk font boldXXwk font, wk font family, wk font italic, wk font size
wk font familyXXwk font, wk font bold, wk font italic, wk font size
wk font italicXXwk font, wk font bold, wk font family, wk font size
wk font sizeXXwk font, wk font bold, wk font family, wk font italic
wk line heightX
wk list fontX
wk list string format LTRX
wk list string format RTLX
wk list style imageX
wk list style image heightX
wk list style image urlX
wk list style typeX
wk marginXwk margin bottom, wk margin left, wk margin right, wk margin top
wk margin bottomXwk margin, wk margin left, wk margin right, wk margin top
wk margin leftXwk margin, wk margin bottom, wk margin right, wk margin top
wk margin rightXwk margin, wk margin bottom, wk margin left, wk margin top
wk margin topXwk margin, wk margin bottom, wk margin left, wk margin right
wk min heightX
wk min widthX
wk nameXX
wk new line style sheetX
wk ownerXX
wk paddingXwk padding bottom, wk padding left, wk padding right, wk padding top
wk padding bottomXwk padding, wk padding left, wk padding right, wk padding top
wk padding boxX
wk padding leftXwk padding, wk padding bottom, wk padding right, wk padding top
wk padding rightXwk padding, wk padding bottom, wk padding left, wk padding top
wk padding topXwk padding, wk padding bottom, wk padding left, wk padding right
_o_wk page break insideX
wk tab defaultXwk tabs, wk tab stop offsets, wk tab stop types, wk tab stop leadings
wk tabsXwk tab default, wk tab stop offsets, wk tab stop types, wk tab stop leadings
wk tab stop offsetsXwk tabs, wk tab default, wk tab stop types, wk tab stop leadings
wk tab stop typesXwk tabs, wk tab default, wk tab stop offsets, wk tab stop leadings
wk tab stop leadingsXwk tabs, wk tab default, wk tab stop offsets, wk tab stop types
wk text alignX
wk text colorXX
wk text indentX
wk text linethrough colorXX
wk text linethrough styleXXwk text underline style
wk text shadow colorXXwk text shadow offset
wk text shadow offsetXXwk text shadow color
wk text transformXX
wk text underline colorXX
wk text underline styleXXwk text linethrough style
wk typeX (read only)X (read only)
wk vertical alignXX
wk widthX