# テキストとリスト

> テキストボックス、段落ブロック、セマンティック PDF リストを挿入、編集します。

- Human documentation: [https://docs.univer.ai/ja-JP/guides/pdfs/features/core/text-and-lists](https://docs.univer.ai/ja-JP/guides/pdfs/features/core/text-and-lists)

- Agent Markdown: [https://docs.univer.ai/ja-JP/guides/pdfs/features/core/text-and-lists.md](https://docs.univer.ai/ja-JP/guides/pdfs/features/core/text-and-lists.md)

- Requested language: `ja-JP`

- Content language: `ja-JP`

- Documentation version: `1.2.0`

- Source: [pdfs/features/core/text-and-lists.ja-JP.mdx](https://github.com/dream-num/documentation/blob/dev/content/guides/pdfs/features/core/text-and-lists.ja-JP.mdx)

---

PDF テキストは、単純な編集可能テキストボックス、ストーリーに基づく段落フレーム、またはセマンティックリストとして扱えます。

## テキストボックス

```ts
const textBox = page.insertTextBox({
  text: 'Quarterly review',
  left: 36,
  top: 36,
  width: 280,
  height: 48,
  fontSize: 20,
})

textBox.setTextStyle({ bold: true, fill: '#1d4ed8' })
textBox.setTextStyle({ italic: true }, { start: 0, end: 9 })
```

`setTextStyle(style, range?)` はボックス全体、または開始を含み終了を含まない UTF-16 範囲にスタイルを適用します。

## 段落

段落ブロックには安定した ID があります。テキスト、スタイル、順序を更新する前に `getBlocks()` で取得してください。

```ts
const paragraph = page.insertParagraph({
  text: 'Release summary',
  left: 36,
  top: 108,
  width: 280,
  height: 96,
})

paragraph.appendBlock({
  text: 'Approved for publication',
  textStyle: { italic: true },
})

const [block] = paragraph.getBlocks()

if (block) {
  paragraph.setBlockStyle(block.id, { align: 'center' })
}
```

## セマンティックリスト

```ts
const list = page.insertList({
  text: 'Verify content',
  kind: univerAPI.Enum.PdfListKind.ORDERED,
  preset: univerAPI.Enum.PdfListPresetId.ORDERED_NUMBER_ALPHA,
  left: 36,
  top: 228,
  width: 280,
  height: 120,
})

list.insertItem(1, { text: 'Export final PDF' })
list.insertItem(2, { text: 'Archive source', level: 1 })
list.setStartNumber(3)
```

リストレベルは `0` から `8` です。レベルを上げるには親になれる先行項目が必要です。`setStartNumber()` は順序付きリストでのみ利用できます。

テキストボックスは `getTextRuns()`、`getTextAnchor()`、`setTextAnchor()` も提供します。段落は `insertBlock()`、`appendBlock()`、`setBlockText()`、`setBlockStyle()`、`removeBlock()` を提供します。
