# Javascript: FormattingStyle.setAutoBaseline Method

> 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.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 30.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: FormattingStyle.setAutoBaseline Method
- **468 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setautobaseline-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setautobaseline-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setautobaseline-method/llms-full.txt

---

### Description

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.

### Syntax

```javascript
<void> FormattingStyle.setAutoBaseline(<AutoBaseline> autoBaseline, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| autoBaseline | The auto baseline of the selected text. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `FormattingStyle.setAutoBaseline` in a practical document-editing workflow. It 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
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function configureAutoBaseline(formattingStyle) {
    formattingStyle.setAutoBaseline(
        TXTextControl.AutoBaseline.Superscript,
        function() {
            console.log("set auto baseline completed.");
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: FormattingStyle.getUnderline Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getunderline-method/llms-full.txt)
- **Next:** [Javascript: FormattingStyle.setBaseline Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/setbaseline-method/llms-full.txt)
