TX Text Control .NET Server

FormattingStyle Object

Object|Introduced in 28.0

Description

The FormattingStyle object represents a styling for a text range.

Syntax

FormattingStyle

Examples

The following example demonstrates FormattingStyle in a practical document-editing workflow. The FormattingStyle object represents a styling for a text range.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function inspectFormattingStyle(formattingStyle) {
    formattingStyle.getAutoBaseline(
        function(result) {
            if (!result) {
                console.warn("No auto baseline was returned.");
                return;
            }
            
            console.log("get auto baseline result:", result);
        },
        onTxError
    );
}

Members

Methods

MethodDescription
applyApplies all set attributes of the style to the current document.
getAutoBaselineGets values specifying automatic sub- or superscripted text. When using automatic sub- and superscript the font is scaled and moved above or below the baseline with values defined through the font itself. Automatic sub- and superscript can be combined with a user-defined baseline which can be set with the Baseline property.
getBaselineGets the baseline alignment, in twips, of the style.
getBaseStyleGets the FormattingStyle which is the base style of this style.
getBoldGets the bold attribute of the style.
getCapitalsGets values specifying wheather lowercase letters are displayed with capital letters. Lowercase letters are displayed either with capital letters of the same size or with capital letters which have a smaller size. The smaller size is either the size of the lowercase 'x' (petite caps) or the size of the lowercase 'x' + 10% (small caps).
getCharacterScalingGets or sets the style's character scaling, in percent of the average character width.
getCharacterSpacingGets the style's character spacing value, in twips. This value is added to each character. When it is negative, character spacing is reduced, otherwise it is extended.
getCultureGets the culture as a languagecode2-country / regioncode2 string value. Takes a callback function as a parameter which is called with a languagecode2-country / regioncode2 string ("de-DE", "en-US" or "en", for example) as a parameter upon receiving the culture value.
getFontNameGets the font of the style.
getFontSizeGets the font's size of the style.
getForeColorGets the style's color used to display the text.
getItalicGets the italic attribute of the style.
getNameGets the name of the style.
getStrikeoutGets the strikeout attribute of the style.
getTextBackColorGets the style's text background color.
getUnderlineGets the underlining styles for the style.
setAutoBaselineSets values specifying automatic sub- or superscripted text. When using automatic sub- and superscript the font is scaled and moved above or below the baseline with values defined through the font itself. Automatic sub- and superscript can be combined with a user-defined baseline which can be set with the Baseline property.
setBaselineSets the baseline alignment, in twips, of the style.
setBoldSets the bold attribute of the style.
setCapitalsSets values specifying wheather lowercase letters are displayed with capital letters. Lowercase letters are displayed either with capital letters of the same size or with capital letters which have a smaller size. The smaller size is either the size of the lowercase 'x' (petite caps) or the size of the lowercase 'x' + 10% (small caps).
setCharacterScalingSets or sets the style's character scaling, in percent of the average character width.
setCharacterSpacingSets the style's character spacing value, in twips. This value is added to each character. When it is negative, character spacing is reduced, otherwise it is extended.
setCultureSets the culture as a languagecode2-country / regioncode2 string value.
setFontNameSets the font of the style.
setFontSizeSets the font's size of the style.
setForeColorSets the style's color used to display the text.
setItalicSets the italic attribute of the style.
setNameSets the name of the style.
setStrikeoutSets the strikeout attribute of the style.
setTextBackColorSets the style's text background color.
setUnderlineSets the underlining styles for the style.