Class Column
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Kolom
Kolom.
Tersedia untuk aplikasi Google Chat dan add-on Google Workspace.
const columnWidget = CardService.newTextParagraph();
const column =
CardService.newColumn()
.setHorizontalSizeStyle(
CardService.HorizontalSizeStyle.FILL_AVAILABLE_SPACE)
.setHorizontalAlignment(CardService.HorizontalAlignment.CENTER)
.setVerticalAlignment(CardService.VerticalAlignment.CENTER)
.addWidget(columnWidget);
Dokumentasi mendetail
setHorizontalAlignment(horizontalAlignment)
Menetapkan HorizontalAlignment
dari Column
. Opsional.
const column = CardService.newColumn().setHorizontalAlignment(
CardService.HorizontalAlignment.CENTER,
);
Parameter
Pulang pergi
Column
— Objek ini, untuk pembuatan rantai.
setHorizontalSizeStyle(horizontalSizeStyle)
Menetapkan HorizontalSizeStyle
Kolom. Opsional.
const column = CardService.newColumn().setHorizontalSizeStyle(
CardService.HorizontalSizeStyle.FILL_AVAILABLE_SPACE,
);
Parameter
Pulang pergi
Column
— Objek ini, untuk pembuatan rantai.
setVerticalAlignment(verticalAlignment)
Menetapkan VerticalAlignment
dari Column
. Opsional.
const column = CardService.newColumn().setVerticalAlignment(
CardService.VerticalAlignment.CENTER,
);
Parameter
Pulang pergi
Column
— Objek ini, untuk pembuatan rantai.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[[["\u003cp\u003eA column is a UI element available for Google Chat apps and Google Workspace Add-ons used to arrange widgets vertically within a card.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can add various widgets like text paragraphs, images, buttons, and input fields to a column using the \u003ccode\u003eaddWidget()\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eColumns offer customization options for horizontal and vertical alignment, as well as horizontal size, through methods like \u003ccode\u003esetHorizontalAlignment()\u003c/code\u003e, \u003ccode\u003esetVerticalAlignment()\u003c/code\u003e, and \u003ccode\u003esetHorizontalSizeStyle()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWidgets within a column are displayed in the order they are added using the \u003ccode\u003eaddWidget\u003c/code\u003e method, allowing for structured layout design.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003esetHorizontalAlignment\u003c/code\u003e, \u003ccode\u003esetHorizontalSizeStyle\u003c/code\u003e, and \u003ccode\u003esetVerticalAlignment\u003c/code\u003e methods are optional and can be used to fine-tune the appearance and layout behavior of the column.\u003c/p\u003e\n"]]],["The core content describes how to use a `Column` within Google Chat apps and Workspace add-ons. Key actions involve creating a `Column` using `CardService.newColumn()`, adding various widgets like `TextParagraph` or `Image` using `addWidget()`, and setting alignment and size styles. `setHorizontalAlignment()`, `setHorizontalSizeStyle()`, and `setVerticalAlignment()` allow for adjusting the column's layout. The method `addWidget` allow adding widget, the order of the widget will be the display order.\n"],null,["# Class Column\n\nColumn\n\nA column.\n\nAvailable for Google Chat apps and Google Workspace add-ons.\n\n```javascript\nconst columnWidget = CardService.newTextParagraph();\nconst column =\n CardService.newColumn()\n .setHorizontalSizeStyle(\n CardService.HorizontalSizeStyle.FILL_AVAILABLE_SPACE)\n .setHorizontalAlignment(CardService.HorizontalAlignment.CENTER)\n .setVerticalAlignment(CardService.VerticalAlignment.CENTER)\n .addWidget(columnWidget);\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------------------------------------------------------------------|-------------|--------------------------------------------------------------------------------------------------------------|\n| [addWidget(widget)](#addWidget(Widget)) | [Column](#) | Adds a widget to the column. |\n| [setHorizontalAlignment(horizontalAlignment)](#setHorizontalAlignment(HorizontalAlignment)) | [Column](#) | Sets the [HorizontalAlignment](/apps-script/reference/card-service/horizontal-alignment) of the [Column](#). |\n| [setHorizontalSizeStyle(horizontalSizeStyle)](#setHorizontalSizeStyle(HorizontalSizeStyle)) | [Column](#) | Sets the [HorizontalSizeStyle](/apps-script/reference/card-service/horizontal-size-style) of the Column. |\n| [setVerticalAlignment(verticalAlignment)](#setVerticalAlignment(VerticalAlignment)) | [Column](#) | Sets the [VerticalAlignment](/apps-script/reference/card-service/vertical-alignment) of the [Column](#). |\n\nDetailed documentation\n----------------------\n\n### `add``Widget(widget)`\n\nAdds a widget to the column.\n\nWidgets are displayed in the order they are added. You can add the following widgets to a\ncolumn:\n\n- [TextParagraph](/apps-script/reference/card-service/text-paragraph)\n- [Image](/apps-script/reference/card-service/image)\n- [DecoratedText](/apps-script/reference/card-service/decorated-text)\n- [ButtonSet](/apps-script/reference/card-service/button-set)\n- [TextInput](/apps-script/reference/card-service/text-input)\n- [SelectionInput](/apps-script/reference/card-service/selection-input)\n- [DateTimePicker](/apps-script/reference/card-service/date-time-picker)\n\n```javascript\nconst column = CardService.newColumn().addWidget(\n CardService.newTextParagraph().setText('This is a text paragraph widget'),\n);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|------------------------------------------------------|----------------------------------|\n| `widget` | [Widget](/apps-script/reference/card-service/widget) | The widget to add to the column. |\n\n#### Return\n\n\n[Column](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Horizontal``Alignment(horizontalAlignment)`\n\nSets the [HorizontalAlignment](/apps-script/reference/card-service/horizontal-alignment) of the [Column](#). Optional.\n\n```javascript\nconst column = CardService.newColumn().setHorizontalAlignment(\n CardService.HorizontalAlignment.CENTER,\n);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|-------------------------|---------------------------------------------------------------------------------|-----------------------------------------|\n| `horizontal``Alignment` | [HorizontalAlignment](/apps-script/reference/card-service/horizontal-alignment) | The horizontal alignment of the column. |\n\n#### Return\n\n\n[Column](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Horizontal``Size``Style(horizontalSizeStyle)`\n\nSets the [HorizontalSizeStyle](/apps-script/reference/card-service/horizontal-size-style) of the Column. Optional.\n\n```javascript\nconst column = CardService.newColumn().setHorizontalSizeStyle(\n CardService.HorizontalSizeStyle.FILL_AVAILABLE_SPACE,\n);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|---------------------------|----------------------------------------------------------------------------------|------------------------------------|\n| `horizontal``Size``Style` | [HorizontalSizeStyle](/apps-script/reference/card-service/horizontal-size-style) | The horizontal size of the column. |\n\n#### Return\n\n\n[Column](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Vertical``Alignment(verticalAlignment)`\n\nSets the [VerticalAlignment](/apps-script/reference/card-service/vertical-alignment) of the [Column](#). Optional.\n\n```javascript\nconst column = CardService.newColumn().setVerticalAlignment(\n CardService.VerticalAlignment.CENTER,\n);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------------------|-----------------------------------------------------------------------------|---------------------------------------|\n| `vertical``Alignment` | [VerticalAlignment](/apps-script/reference/card-service/vertical-alignment) | The vertical alignment of the column. |\n\n#### Return\n\n\n[Column](#) --- This object, for chaining."]]