# FormattingStyle Object

> The FormattingStyle object represents a styling for a text range.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Object
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > FormattingStyle Object
- **1955 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/llms-full.txt

---

### Description

The FormattingStyle object represents a styling for a text range.

### Syntax

```javascript
FormattingStyle
```

### Examples

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

```javascript
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
    );
}
```

---

## In This Section

- [Javascript: FormattingStyle.apply Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/apply-method/llms-full.txt): Applies all set attributes of the style to the current document.
- [Javascript: FormattingStyle.getAutoBaseline Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getautobaseline-method/llms-full.txt): Gets 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.
- [Javascript: FormattingStyle.getBaseline Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getbaseline-method/llms-full.txt): Gets the baseline alignment, in twips, of the style.
- [Javascript: FormattingStyle.getBaseStyle Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getbasestyle-method/llms-full.txt): Gets the FormattingStyle which is the base style of this style.
- [Javascript: FormattingStyle.getBold Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getbold-method/llms-full.txt): Gets the bold attribute of the style.
- [Javascript: FormattingStyle.getCapitals Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getcapitals-method/llms-full.txt): Gets 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).
- [Javascript: FormattingStyle.getCharacterScaling Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getcharacterscaling-method/llms-full.txt): Gets or sets the style's character scaling, in percent of the average character width.
- [Javascript: FormattingStyle.getCharacterSpacing Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getcharacterspacing-method/llms-full.txt): Gets 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.
- [Javascript: FormattingStyle.getCulture Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getculture-method/llms-full.txt): Gets 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.
- [Javascript: FormattingStyle.getFontName Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getfontname-method/llms-full.txt): Gets the font of the style.
- [Javascript: FormattingStyle.getFontSize Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getfontsize-method/llms-full.txt): Gets the font's size of the style.
- [Javascript: FormattingStyle.getForeColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getforecolor-method/llms-full.txt): Gets the style's color used to display the text.
- [Javascript: FormattingStyle.getItalic Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getitalic-method/llms-full.txt): Gets the italic attribute of the style.
- [Javascript: FormattingStyle.getName Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getname-method/llms-full.txt): Gets the name of the style.
- [Javascript: FormattingStyle.getStrikeout Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getstrikeout-method/llms-full.txt): Gets the strikeout attribute of the style.
- [Javascript: FormattingStyle.getTextBackColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/gettextbackcolor-method/llms-full.txt): Gets the style's text background color.
- [Javascript: FormattingStyle.getUnderline Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getunderline-method/llms-full.txt): Gets the underlining styles for the style.
- [Javascript: FormattingStyle.setAutoBaseline Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setautobaseline-method/llms-full.txt): Sets 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.
- [Javascript: FormattingStyle.setBaseline Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setbaseline-method/llms-full.txt): Sets the baseline alignment, in twips, of the style.
- [Javascript: FormattingStyle.setBold Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setbold-method/llms-full.txt): Sets the bold attribute of the style.
- [Javascript: FormattingStyle.setCapitals Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setcapitals-method/llms-full.txt): Sets 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).
- [Javascript: FormattingStyle.setCharacterScaling Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setcharacterscaling-method/llms-full.txt): Sets or sets the style's character scaling, in percent of the average character width.
- [Javascript: FormattingStyle.setCharacterSpacing Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setcharacterspacing-method/llms-full.txt): Sets 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.
- [Javascript: FormattingStyle.setCulture Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setculture-method/llms-full.txt): Sets the culture as a languagecode2-country / regioncode2 string value.
- [Javascript: FormattingStyle.setFontName Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setfontname-method/llms-full.txt): Sets the font of the style.
- [Javascript: FormattingStyle.setFontSize Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setfontsize-method/llms-full.txt): Sets the font's size of the style.
- [Javascript: FormattingStyle.setForeColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setforecolor-method/llms-full.txt): Sets the style's color used to display the text.
- [Javascript: FormattingStyle.setItalic Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setitalic-method/llms-full.txt): Sets the italic attribute of the style.
- [Javascript: FormattingStyle.setName Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setname-method/llms-full.txt): Sets the name of the style.
- [Javascript: FormattingStyle.setStrikeout Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setstrikeout-method/llms-full.txt): Sets the strikeout attribute of the style.
- [Javascript: FormattingStyle.setTextBackColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/settextbackcolor-method/llms-full.txt): Sets the style's text background color.
- [Javascript: FormattingStyle.setUnderline Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setunderline-method/llms-full.txt): Sets the underlining styles for the style.

---

## Nearby

- **Previous:** [Javascript: FormattedText.trackedChanges Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/trackedchanges-property/llms-full.txt)
- **Next:** [Javascript: FormattingStyle.apply Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/apply-method/llms-full.txt)
