Enum 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):2024-12-22。
[null,null,["最后更新时间 (UTC):2024-12-22。"],[[["`VerticalAlignment` is used to define how content is vertically aligned within a table cell."],["It offers three options: `TOP`, `CENTER`, and `BOTTOM` for aligning content to the top, center, or bottom of the cell, respectively."],["You can set the vertical alignment of a table cell using `DocumentApp.VerticalAlignment` and the desired alignment property within your Apps Script code."]]],["`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"]]