# Block.TextualBlock.addTextStyle
Adds a style to the specified range of text. This method is called synchronously.

## Availability description

Permission requirements | View Available Description | Platform is available | scene
---|---|---|---
No permission required | All views | - PC<br>- Mobile | Presentation mode

## Input

Text data, added styles, and specified text range for processing, default all is not specified
| **Name** | **Data type**                                                                                                                                       | **Is required** | **Description**                                                  |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | ---------------------------------------------------------------- |
| data     | [TextualBlockData](https://open.feishu.cn/document/uAjLw4CM/uYjL24iN/docs-add-on/05-api-doc/BlockData/textualblockdata) | Yes             | Text data                                                        |
| style    | [TextStyle](https://open.feishu.cn/document/uAjLw4CM/uYjL24iN/docs-add-on/05-api-doc/BlockData/textblockdata/textrun/textstyle)                                               | Yes             | Added styles                                                     |
| range    | [number, number]                                                                                                                                   | No              | Specify the range of text to process, do not specify default all |

## Output

Returns a TextBlockData object

## Example code

### Calling example

```js
 const docRef = await DocMiniApp.getActiveDocumentRef();
 const blockRef = DocMiniApp.getBlockRefById(docRef,7);
 const textblock = await DocMiniApp.Block.getBlock(blockRef);
 const newData = DocMiniApp.Block.TextualBlock.addTextStyle(textblock.data as TextBlockData,{bold: true,underline:true},[1,2]);
 console.log('debug',newData);
```

### Return example

```json
{
  "text":
  {
    "elements":
    [{
      "text_run": {
        "content": "demo",
        "style": {
          "inline_code": false,
          "bold": false,
          "italic": false,
          "underline": false,
          "strikethrough": false
        }
      }
    },
    {
      "text_run": {
        "content": "demo",
        "style": {
          "inline_code": false,
          "bold": true,
          "italic": false,
          "underline": true,
          "strikethrough": false
        }
      }
    }]
  },
  "plain_text": "demo"
}
```