Tutorials

Tutorial

Text formatting

Deutsche Version

User definied cell formats

A user definied cell format consists of a record of the type t_rec_customStyles

TYPE t_rec_customStyles IS RECORD(
     id                 VARCHAR2(50)
    ,type               VARCHAR2(50)
    ,format             VARCHAR2(200)
    ,font               t_rec_font
    ,background         t_rec_background
    ,border             t_tab_border
    ,alignment          t_rec_alignment
    ,protection         BOOLEAN
    );
id
Name of the custom format. To be used for p_format when calling writeData. Has to be unique within the spreadsheet. s22 to s43 are predefined by the package. Allowed are the letters a-z, numbers and underscore.
type
Data type Text, Date or Number. An exception is Percent, as it is derived from a parent formatting.
format
Except for text you have to specify a format. This defines e.g., how many decimal places are shown or whether the date is show with time fraction. Often used formats are predefined in the package header, see c_nfXXX for numbers and c_dfXXX for dates. Additionally any format is allowed which you can use in Excel. The easiest way to find the notation is to define a cell as you need in Exec and save as XML-format.

font
The font consists of a record:
TYPE t_rec_font IS RECORD(
     fName              VARCHAR2(50)
    ,fFamily            VARCHAR2(50)
    ,fSize              PLS_INTEGER
    ,fColor             VARCHAR2(50)
    ,fBold              BOOLEAN
    ,fItalic            BOOLEAN
    ,fStrikeThrough     BOOLEAN
    ,fUnderline         VARCHAR2(50)
    ,fPosition          VARCHAR2(50)
    );
fName
Font name, e.g.. 'Times New Roman','Courier New','Wingdings',... Default is 'Arial'
fFamily
Font family to be used when the font is not available at the target system: 'Automatic', 'Decorative', 'Modern', 'Roman', 'Script', 'Swiss'
fSize
Font size in pt
fColor
Font color. Predefines values are provided in the package header, e.g. c_red or c_blue, but any RGB-value like '#FF99CC' is allowed. Default is black
fBold
set text in bold
fItalic
Italicize text
fStrikeThrough
Strike the text
fUnderline
underline. Allowed values: 's' = single, 'd' = double, 'as' = accounting single, 'ad' = accounting double. Accounting means that the line is drawn farther from the text, so descenders wont be crossed.
fPosition
Text position. Allowed values: 'Subscript' and 'Superscript'

If one of this values is omitted, the cell inherits the value of the parent element (column or row).

background
The background consists of a record:
TYPE t_rec_background IS RECORD(
     bColor             VARCHAR2(50)
    ,bPattern           VARCHAR2(50)
    ,bPatternColor      VARCHAR2(50)
    );
bColor
Backgroung color. For allowed values see font fColor
bPattern
Backgroud pattern. For allowed values see constnts c_bgpXXX in package header. Default Solid
bPatternColor
Secondary pattern color. For allowed values see font fColor

If one of this values is omitted, the cell inherits the value of the parent element (column or row).

border
The definition for borders is a PL/SQL table, composed of following rowtype:
TYPE t_rec_border IS RECORD(
     bPosition          VARCHAR2(60)
    ,bLineStyle         VARCHAR2(50)
    ,bWeight            PLS_INTEGER
    ,bColor             VARCHAR2(50)
    );
bPosition
Position of the border, the formatting is applied to: 'Top', 'Bottom', 'Left', 'Right', 'DiagonalRight' = diagonally from left top to right down, 'DiagonalLeft' = diagonally from left down to right top. To apply the foratting to more than one border separate the positions by commas, e.g. 'Top,Bottom'
bLineStyle
Line style: 'Dot', 'DashDot', 'DashDotDot', 'Dash', 'SlantDashDot'(use it with weight 2), 'Double' = doppelt (use it with weight 3). Default 'Continuous'
bWeight
Line weight: 1,2 or 3. 0 = hairline, 1 = thin, 2 = middle, 3 = thick. Default 0.
bColor
Border color. For allowed values see font fColor

If one of this values is omitted, the cell inherits the value of the parent element (column or row).

alignment
The alignment consists of a record:
TYPE t_rec_alignment IS RECORD(
     vertical           VARCHAR2(50)
    ,horizontal         VARCHAR2(50)
    ,textRotate         PLS_INTEGER
    ,readingOrder       VARCHAR2(30)
    ,shrinkToFit        BOOLEAN
    ,verticalText       BOOLEAN
    ,wrapText           BOOLEAN
    );
vertical
Vertical alignment: 'Top', 'Bottom'n, 'Center'. Default is 'top'
horizontal
horizontal alignment: 'Left', 'Right', 'Center', 'Justify', 'Fill'
textRotate
Rotate text from level. Default 0.
readingOrder
Specifies the text entry mode for a cell: 'RightToLeft', 'LeftToRight' or 'Context'
shrinkToFit
TRUE means that the text size should be shrunk so that all of the text fits within the cell.
verticalText
Specifies whether the text is drawn "downwards", whereby each letter is drawn horizontally, one above the other.
wrapText
Specifies whether the text in this cell should wrap at the cell boundary.

If one of this values is omitted, the cell inherits the value of the parent element (column or row).

protection
Protect cell from accidental changes by user. The user can override this protection. A protection by password is not pssible.