# Javascript: TXTextControl.getCanDocumentFormat Method

> Informs whether the document can be formatted with page and section formatting attributes. The value depends on whether the formatting is allowed and the currently set edit mode.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: TXTextControl.getCanDocumentFormat Method
- **427 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/getcandocumentformat-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/getcandocumentformat-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/getcandocumentformat-method/llms-full.txt

---

### Description

Informs whether the document can be formatted with page and section formatting attributes. The value depends on whether the [formatting is allowed](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/documentpermissions/allowformatting-property/llms-full.txt) and the currently set edit mode.

### Syntax

```javascript
<void> TXTextControl.getCanDocumentFormat(<RequestBooleanCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | The callback function that receives the requested value. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TXTextControl.getCanDocumentFormat` in a practical document-editing workflow. Informs whether the document can be formatted with page and section formatting attributes. The value depends on whether the formatting is allowed and the currently set edit mode.

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

TXTextControl.getCanDocumentFormat(
    function(result) {
        if (result) {
            console.log("get can document format is available.");
        } else {
            console.warn("get can document format is not available in the current document state.");
        }
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: TXTextControl.getCanCopy Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/getcancopy-method/llms-full.txt)
- **Next:** [Javascript: TXTextControl.getCanPaste Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/getcanpaste-method/llms-full.txt)
