This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v19
4D View Pro Style Objects and Style Sheets

4D View Pro Style Objects and Style Sheets  


 

4D View Pro style objects and style sheets allow you to control the graphical aspects and the look of your 4D View Pro documents. 

Style objects contain the style property settings. They can be used either in a style sheet or on their own. Style objects can also be used in addition to a style sheet so that different settings can be specified for individual cell ranges without affecting the rest of the document. 

You can use style objects directly with the VP SET CELL STYLE and VP SET DEFAULT STYLE commands.

A style sheet groups together a combination of properties in a style object (see below) to specify the look of all of the cells in your 4D View Pro documents. Style sheets saved with the document can be used to set the properties for a single sheet, multiple sheets, or an entire workbook.

When created, a 4D View Pro style sheet is given a name which is saved within the style sheet in the "name" property. This allows a style sheet to be easily used and, if thoughtfully selected, can facilitate its identification and purpose (e.g., Letterhead_internal, Letterhead_external).

Style sheets are created with the VP ADD STYLESHEET command and applied with the the VP SET DEFAULT STYLE or VP SET CELL STYLE commands. You can  remove a style sheet with the VP REMOVE STYLESHEET command.

The VP Get stylesheet command can be used to return the style object of a single style sheet or you can use the VP Get stylesheets command to retrieve a collection of style objects for multiple style sheets.

You can find detailed descriptions of the possible values below on the 4D View Pro Constants page.

PropertyTypeDescriptionPossible values
backColortextDefines the color of the background. CSS color "#rrggbb" syntax (preferred syntax), CSS color "rgb(r,g,b)" syntax (alternate syntax), CSS color name (alternate syntax)
backgroundImagepicture, textSpecifies a background image. Can be specified directly or via the image path (full path or file name only). If the file name only is used, the file must be located next to the database structure file. No matter how set (picture or text), a picture is saved with the document. This could impact the size of a document if the image is large. Note for Windows: File extension must be included. 
backgroundImageLayoutlongintDefines the layout for the background image. vk image layout center, vk image layout none, vk image layout stretch, vk image layout zoom
foreColortextDefines the color of the foreground. CSS color "#rrggbb" syntax (preferred syntax), CSS color "rgb(r,g,b)" syntax (alternate syntax), CSS color name (alternate syntax)
Borders  

PropertySubpropertyTypeDescriptionPossible values
borderBottom, borderLeft, borderRight, borderTop, diagonalDown,diagonalUp objectDefines the corresponding border line 
colortextDefines the color of the border. Default = black. CSS color "#rrggbb" syntax (preferred syntax), CSS color "rgb(r,g,b)" syntax (alternate syntax), CSS color name (alternate syntax)
stylelongintDefines the style of the border. Default = empty. Cannot be null or undefined. vk line style dash dot, vk line style dash dot dot, vk line style dashed, vk line style dotted, vk line style double, vk line style empty, vk line style hair, vk line style medium, vk line style medium dash dot, vk line style medium dash dot dot, vk line style medium dashed, vk line style slanted dash dot, vk line style thick, vk line style thick

PropertySubpropertyTypeDescriptionPossible values
fonttextSpecifies the font characteristics in CSS font shorthand ("font-style font-variant font-weight font-size/line-height font-family"). Example: "14pt Century Gothic". The font-size and font-family values are mandatory. If one of the other values is missing, their default values are used. Note: If a font name contains a space, the name must be within quotes. A CSS font shorthand.

4D provides utility commands to handle font characteristics as objects: VP Font to object and VP Object to font

formattertextPattern for value/time property. Number/text/date/time formats, special characters. See 4D View Pro Cell Format section.
isVerticalTextbooleanSpecifies text direction. True = vertical text, False = horizontal text.
labelOptionsobjectDefines cell label options (watermark options).
alignmentlongintSpecifies the position of the cell label. Optional property.vk label alignment top left, vk label alignment bottom left, vk label alignment top center, vk label alignment bottom center, vk label alignment top right, vk label alignment bottom right
visibilitylongintSpecifies the visibility of the cell label. Optional property. vk label visibility auto, vk label visibility hidden, vk label visibility visible
foreColortextDefines the color of the foreground. Optional property. CSS color "#rrggbb" syntax (preferred syntax), CSS color "rgb(r,g,b)" syntax (alternate syntax), CSS color name (alternate syntax)
fonttextSpecifies the font characteristics with CSS font shorthand ("font-style font-variant font-weight font-size/line-height font-family"). The font-size and font-family values are mandatory.
textDecorationlongintSpecifies the decoration added to text. vk text decoration double underline, vk text decoration line through, vk text decoration none, vk text decoration overline, vk text decoration underline
textIndentlongintDefines the unit of text indention. 1 = 8 pixels
textOrientation longintDefines the rotation angle of the text in a cell.Number between -90 and 90
watermarktextDefines the watermark (cell label) content
wordWrapbooleanSpecifies if text should be wrapped. True = wrapped text, False = unwrapped text
Layout  

PropertyTypeDescriptionPossible values
cellPaddingtextDefines the cell padding  
hAlignlongintDefines the horizontal alignment of cell contents. vk horizontal align center, vk horizontal align general, vk horizontal align left, vk horizontal align right
lockedbooleanSpecifies cell protection status. Note, this is only available if sheet protection is enabled (see Sheet protection section). True = locked, False = unlocked.
shrinkToFitbooleanSpecifies if the contents of the cell should be reduced. True = reduced content, False = no reduction.
tabStopbooleanSpecifies if the focus to the cell can be set using the Tab key. True = Tab key sets focus, False = Tab key does not set focus.
vAlignlongintSpecifies the vertical alignment of cell contents. vk vertical align bottom, vk vertical align center, vk vertical align top

PropertyTypeDescription
nametextDefines the name of the style 
parentNametextSpecifies the style that the current style is based on. Values from the parent style will be applied, then any values from the current style are applied. Changes made in the current style will not be refelected in the parent style. Only available when using a style sheet.
 



See also 

VP ADD STYLESHEET
VP Font to object
VP Get stylesheet
VP Object to font

 
PROPERTIES 

Product: 4D
Theme: 4D View Pro Language

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v17 R6

 
ARTICLE USAGE

4D View Pro Reference ( 4D v19)