Class Divider
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Divider
Một đường phân chia theo chiều ngang. Để thêm đường phân chia vào thẻ bổ sung, hãy sử dụng phương thức newDivider()
trong CardService
. Ví dụ: mẫu sau đây tạo một thẻ đơn giản có 2 đoạn văn được phân tách bằng một đường phân chia.
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;
}
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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```"]]