> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/zh/chuang-jian-nei-rong/blocks/table.md).

# 表格

你可以在 GitBook 页面中添加表格，以更好地组织信息。你可以在下面的示例表格中查看可实现效果的示例：

<table data-full-width="false"><thead><tr><th>公司</th><th>状态<select><option value="36bef47f343d4588bc43db3e5c701796" label="进行中" color="blue"></option></select></th><th>联系</th><th>MRR</th><th data-hidden>联系</th><th data-hidden>MRR</th><th data-hidden>状态<select><option value="3e7a52c673ec4a01992566d18271f7a5" label="进行中" color="blue"></option><option value="2362fd3eafc7476fb8646ac754f34b72" label="已完成" color="blue"></option></select></th></tr></thead><tbody><tr><td><strong>Ace AI</strong> – 设计</td><td><span data-option="36bef47f343d4588bc43db3e5c701796">进行中</span></td><td><a href="mailto:noreply@gitbook.com">rena@ace.ai</a></td><td>$450</td><td><a href="mailto:noreply@gitbook.com">rena@ace.ai</a></td><td>$420</td><td><span data-option="3e7a52c673ec4a01992566d18271f7a5">进行中</span></td></tr><tr><td><strong>Discrete Data</strong> – API</td><td><span data-option="36bef47f343d4588bc43db3e5c701796">进行中</span></td><td><a href="mailto:noreply@gitbook.com">dave@dd.inc</a></td><td>$100</td><td><a href="mailto:noreply@gitbook.com">dave@dd.inc</a></td><td>$69</td><td></td></tr><tr><td><strong>Example Co</strong></td><td></td><td><a href="mailto:pete@example.com">pete@example.com</a></td><td>$50</td><td></td><td></td><td></td></tr></tbody></table>

### 表格块选项

当你打开表格块左侧的“选项”菜单时，你会看到许多用于更改外观和管理表格内数据的选项：

* **表格/卡片：** 选择将数据显示为表格块或卡片块。GitBook 使用相同的数据填充这两种块，因此你可以根据想要的外观和设计在它们之间切换。
* **添加列：** 在表格右侧添加一个新列。你可以通过菜单选择列类型，或者直接点击 **添加列** 来添加文本列。
* **插入行：** 在表格底部添加一个新行。
* **显示表头：** 隐藏或显示表格顶部的标题行。
* **冻结表头：** 在你向下滚动查看下面的各行时，保持表格顶部行在页面中可见。这对于较大的表格很有用，因为你希望列标题始终可见。
* **冻结第一列：** 在你水平滚动查看右侧各列时，保持表格最左侧列可见。这对于超出页面宽度的较宽表格很有用，因为你希望行标签或标识符始终可见。
* **重置列宽：** 如果你已经更改了列宽，这将把它们全部重置为再次相等。
* **可见列：** 选择哪些列可见、哪些列隐藏。如果你的表格中有隐藏列，可以在这个菜单中将它们重新显示出来。
* **删除：** 删除表格块及其所有内容。

### 更改列类型

根据你想显示的数据，可以为表格列设置不同的数据类型。这些类型会为该列中的每个单元格添加格式、装饰或限制：

* **文本：** 标准文本列，支持标准格式。
* **数字：** 数字列，可带或不带小数位。
* **复选框：** 每行一个可勾选或取消勾选的复选框。
* **选择：** 你可以从一组可定义的选项列表中选择数据，方法是打开 **列选项** 菜单并选择 **管理选项**。这可以是单选或多选。
* **用户：** 你可以添加你所在组织某位成员的姓名和头像。这可以是单选或多选。
* **文件：** 引用该部分中的一个文件。你可以在填充该列单元格时上传新文件。
* **评分：** 星级评分。你可以通过打开 **列选项** 菜单并选择 **最大值**.

使用 **列选项** 菜单来更改列类型。当你更改列类型时，系统会提示你确认更改，因为此操作可能会删除或破坏列数据。

### 调整列宽

将鼠标悬停在列边缘并拖动即可调整大小。光标上方会显示像素数，以帮助你设置一致的列宽。

GitBook 会将列宽存储为整体宽度的百分比，这样就可以基于表格的整体宽度进行相对调整。

### 可滚动表格

比编辑器容器更宽的表格将可以水平滚动。

### 列选项

要重新排序列，请单击并拖动 <picture><source srcset="/files/HXFvPsjDqbaBEhpH0WKJ" media="(prefers-color-scheme: dark)"><img src="/files/950d2c0e21d4aa4c603de07a2bc5d827c0d5cbde" alt="The table drag handle icon in GitBook"></picture> 位于你想移动的列顶部的拖拽手柄。

你可以通过单击 **添加列** 按钮来添加新列，该按钮会在你悬停于表格右边缘时出现。

在 **列选项** 菜单中，你还可以打开或关闭自动调整大小、在右侧添加新列、隐藏该列或删除该列。

### 行选项

将鼠标悬停在该行上并单击左侧出现的 **行选项** <picture><source srcset="/files/YjlF3Z9KMYv9aQiFzZKD" media="(prefers-color-scheme: dark)"><img src="/files/d05670ba93b683794fb3fe95a9fc7ab5c7fceafd" alt="The Row options menu icon in GitBook"></picture> 按钮以打开 **行选项** 菜单。你会看到许多选项：

* **打开行：** 在一个模态窗口中打开该行，显示其所有数据。你可以在这里快速更改行类型、编辑数据，并查看隐藏列中的数据。
* **在上方/下方插入：** 在当前选中行的上方或下方添加一个新行。
* **添加列：** 在表格右侧添加一个新列。
* **删除行：** 将该行中的所有数据从表格中永久移除。

### 表格中的图片

当你点击表格单元格时，可以按 / 键插入图片。图片不能添加到表格的表头行。

### Markdown 中的表示

```markdown
# 表格

|   |   |   |
| - | - | - |
|   |   |   |
|   |   |   |
|   |   |   |
```

<details>

<summary>我可以在 GitBook 中创建嵌套表格吗？</summary>

GitBook 中不支持嵌套表格。为了确保文档易于编写、渲染可靠，并且对所有用户都可访问，GitBook 保持表格扁平结构。

一旦表格位于另一个表格单元格中，就会变得难以编辑、调整大小、导航，或在不同设备之间保持一致的格式。

嵌套表格还会给底层文档结构带来显著复杂性，常常破坏清晰的语义，并导致诸如 Git Sync 之类功能出现不可预测的行为。

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gitbook.com/docs/documentation/zh/chuang-jian-nei-rong/blocks/table.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
