Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
Enum VerticalAlignment
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
VerticalAlignment
支持的垂直对齐类型的枚举。
如需调用枚举,您需要调用其父类、名称和属性。例如
DocumentApp.VerticalAlignment.BOTTOM。
使用 VerticalAlignment 枚举设置表格单元格的垂直对齐方式。
const body =
DocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody();
// Append table containing two cells.
const table = body.appendTable([['Top', 'Center', 'Bottom']]);
// Align the first cell's contents to the top.
table.getCell(0, 0).setVerticalAlignment(DocumentApp.VerticalAlignment.TOP);
// Align the second cell's contents to the center.
table.getCell(0, 1).setVerticalAlignment(DocumentApp.VerticalAlignment.CENTER);
// Align the third cell's contents to the bottom.
table.getCell(0, 2).setVerticalAlignment(DocumentApp.VerticalAlignment.BOTTOM);
属性
| 属性 | 类型 | 说明 |
BOTTOM | Enum | 底部对齐选项。 |
CENTER | Enum | 居中对齐选项。 |
TOP | Enum | 顶部对齐选项。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-04-13。
[null,null,["最后更新时间 (UTC):2026-04-13。"],[],["`VerticalAlignment` enum sets the vertical alignment of table cells in a document. It's accessed via `DocumentApp.VerticalAlignment`. Available options are `BOTTOM`, `CENTER`, and `TOP`. To use it, call `setVerticalAlignment()` on a table cell object with the desired alignment type. The example code demonstrates creating a table with three cells and aligning their content to the top, center, and bottom, respectively.\n"]]