Class Divider
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Separator
Linia podziału poziomego. Aby dodać separator do karty dodatku, użyj metody newDivider()
w bloku CardService
. Na przykład poniższy przykład tworzy prostą kartę z 2 akapitami rozdzielonymi linią.
function buildCard() {
const cardSection1TextParagraph1 =
CardService.newTextParagraph().setText('Hello world!');
const cardSection1Divider1 = CardService.newDivider();
const cardSection1TextParagraph2 =
CardService.newTextParagraph().setText('Hello world!');
const cardSection1 = CardService.newCardSection()
.addWidget(cardSection1TextParagraph1)
.addWidget(cardSection1Divider1)
.addWidget(cardSection1TextParagraph2);
const card = CardService.newCardBuilder().addSection(cardSection1).build();
return card;
}
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-26 UTC."],[[["\u003cp\u003eHorizontal dividers are visual elements used to separate content within an add-on card for better readability.\u003c/p\u003e\n"],["\u003cp\u003eUse the \u003ccode\u003enewDivider()\u003c/code\u003e method within the \u003ccode\u003eCardService\u003c/code\u003e class to create a divider element.\u003c/p\u003e\n"],["\u003cp\u003eDividers can be added to card sections along with other widgets like text paragraphs.\u003c/p\u003e\n"]]],[],null,["# Class Divider\n\nDivider\n\nA horizontal divider. To add a divider to your add-on card, use the `new``Divider()`\nmethod within [CardService](/apps-script/reference/card-service/card-service). For example, the following sample builds a simple card with 2\nparagraphs separated by a divider.\n\n```javascript\nfunction buildCard() {\n const cardSection1TextParagraph1 =\n CardService.newTextParagraph().setText('Hello world!');\n\n const cardSection1Divider1 = CardService.newDivider();\n\n const cardSection1TextParagraph2 =\n CardService.newTextParagraph().setText('Hello world!');\n\n const cardSection1 = CardService.newCardSection()\n .addWidget(cardSection1TextParagraph1)\n .addWidget(cardSection1Divider1)\n .addWidget(cardSection1TextParagraph2);\n\n const card = CardService.newCardBuilder().addSection(cardSection1).build();\n\n return card;\n}\n```"]]