Class TextStyleBuilder
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.
TextStyleBuilder
Trình tạo kiểu văn bản.
Tài liệu chi tiết
build()
Tạo kiểu văn bản từ trình tạo này.
Cầu thủ trả bóng
TextStyle
– Kiểu văn bản được tạo từ trình tạo này.
setBold(bold)
Đặt xem văn bản có in đậm hay không.
Tham số
Tên | Loại | Mô tả |
bold | Boolean | Liệu văn bản có được in đậm hay không. |
Cầu thủ trả bóng
TextStyleBuilder
– Trình tạo để tạo chuỗi.
setFontFamily(fontFamily)
Đặt bộ phông chữ văn bản, chẳng hạn như "Arial".
Tham số
Tên | Loại | Mô tả |
fontFamily | String | Bộ phông chữ mong muốn. |
Cầu thủ trả bóng
TextStyleBuilder
– Trình tạo để tạo chuỗi.
setFontSize(fontSize)
Đặt cỡ chữ văn bản theo điểm.
Tham số
Tên | Loại | Mô tả |
fontSize | Integer | Cỡ chữ mong muốn. |
Cầu thủ trả bóng
TextStyleBuilder
– Trình tạo để tạo chuỗi.
setForegroundColor(cssString)
Đặt màu phông chữ cho văn bản.
Tham số
Tên | Loại | Mô tả |
cssString | String | Màu phông chữ mong muốn theo ký hiệu CSS (chẳng hạn như '#ffffff' hoặc 'white' ). |
Cầu thủ trả bóng
TextStyleBuilder
– Trình tạo để tạo chuỗi.
setForegroundColorObject(color)
Đặt màu phông chữ cho văn bản.
Tham số
Tên | Loại | Mô tả |
color | Color | Màu phông chữ mong muốn. |
Cầu thủ trả bóng
TextStyleBuilder
– Trình tạo để tạo chuỗi.
setItalic(italic)
Đặt xem văn bản có in nghiêng hay không.
Tham số
Tên | Loại | Mô tả |
italic | Boolean | Liệu văn bản có được in nghiêng hay không. |
Cầu thủ trả bóng
TextStyleBuilder
– Trình tạo để tạo chuỗi.
setStrikethrough(strikethrough)
Đặt xem văn bản có bị gạch ngang hay không.
Tham số
Tên | Loại | Mô tả |
strikethrough | Boolean | Liệu văn bản có bị gạch ngang hay không. |
Cầu thủ trả bóng
TextStyleBuilder
– Trình tạo để tạo chuỗi.
setUnderline(underline)
Đặt xem văn bản có được gạch dưới hay không.
Tham số
Tên | Loại | Mô tả |
underline | Boolean | Liệu văn bản có được gạch dưới hay không. |
Cầu thủ trả bóng
TextStyleBuilder
– Trình tạo để tạo chuỗi.
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\u003e\u003ccode\u003eTextStyleBuilder\u003c/code\u003e helps create custom text styles with various formatting options.\u003c/p\u003e\n"],["\u003cp\u003eYou can specify font family, size, color, and styles like bold, italic, underline, and strikethrough.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods like \u003ccode\u003esetBold\u003c/code\u003e, \u003ccode\u003esetFontFamily\u003c/code\u003e, \u003ccode\u003esetFontSize\u003c/code\u003e, and others to define text attributes.\u003c/p\u003e\n"],["\u003cp\u003eUse the \u003ccode\u003ebuild()\u003c/code\u003e method to create a \u003ccode\u003eTextStyle\u003c/code\u003e object with your defined formatting.\u003c/p\u003e\n"],["\u003cp\u003eThis builder enables flexible and detailed control over text presentation in Google Apps Script.\u003c/p\u003e\n"]]],[],null,["# Class TextStyleBuilder\n\nTextStyleBuilder\n\nA builder for text styles. \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------------------------------------------|------------------------------------------------------------|-------------------------------------------------|\n| [build()](#build()) | [TextStyle](/apps-script/reference/spreadsheet/text-style) | Creates a text style from this builder. |\n| [setBold(bold)](#setBold(Boolean)) | [TextStyleBuilder](#) | Sets whether or not the text is bold. |\n| [setFontFamily(fontFamily)](#setFontFamily(String)) | [TextStyleBuilder](#) | Sets the text font family, such as \"Arial\". |\n| [setFontSize(fontSize)](#setFontSize(Integer)) | [TextStyleBuilder](#) | Sets the text font size in points. |\n| [setForegroundColor(cssString)](#setForegroundColor(String)) | [TextStyleBuilder](#) | Sets the text font color. |\n| [setForegroundColorObject(color)](#setForegroundColorObject(Color)) | [TextStyleBuilder](#) | Sets the text font color. |\n| [setItalic(italic)](#setItalic(Boolean)) | [TextStyleBuilder](#) | Sets whether or not the text is italic. |\n| [setStrikethrough(strikethrough)](#setStrikethrough(Boolean)) | [TextStyleBuilder](#) | Sets whether or not the text has strikethrough. |\n| [setUnderline(underline)](#setUnderline(Boolean)) | [TextStyleBuilder](#) | Sets whether or not the text is underlined. |\n\nDetailed documentation\n----------------------\n\n### `build()`\n\nCreates a text style from this builder.\n\n#### Return\n\n\n[TextStyle](/apps-script/reference/spreadsheet/text-style) --- A text style created from this builder.\n\n*** ** * ** ***\n\n### `set``Bold(bold)`\n\nSets whether or not the text is bold.\n\n#### Parameters\n\n| Name | Type | Description |\n|--------|-----------|----------------------------------|\n| `bold` | `Boolean` | Whether or not the text is bold. |\n\n#### Return\n\n\n[TextStyleBuilder](#) --- The builder for chaining.\n\n*** ** * ** ***\n\n### `set``Font``Family(fontFamily)`\n\nSets the text font family, such as \"Arial\".\n\n#### Parameters\n\n| Name | Type | Description |\n|----------------|----------|--------------------------|\n| `font``Family` | `String` | The desired font family. |\n\n#### Return\n\n\n[TextStyleBuilder](#) --- The builder for chaining.\n\n*** ** * ** ***\n\n### `set``Font``Size(fontSize)`\n\nSets the text font size in points.\n\n#### Parameters\n\n| Name | Type | Description |\n|--------------|-----------|------------------------|\n| `font``Size` | `Integer` | The desired font size. |\n\n#### Return\n\n\n[TextStyleBuilder](#) --- The builder for chaining.\n\n*** ** * ** ***\n\n### `set``Foreground``Color(cssString)`\n\nSets the text font color.\n\n#### Parameters\n\n| Name | Type | Description |\n|---------------|----------|----------------------------------------------------------------------------|\n| `css``String` | `String` | The desired font color in CSS notation (such as `'#ffffff'` or `'white'`). |\n\n#### Return\n\n\n[TextStyleBuilder](#) --- The builder for chaining.\n\n*** ** * ** ***\n\n### `set``Foreground``Color``Object(color)`\n\nSets the text font color.\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|---------------------------------------------------|-------------------------|\n| `color` | [Color](/apps-script/reference/spreadsheet/color) | The desired font color. |\n\n#### Return\n\n\n[TextStyleBuilder](#) --- The builder for chaining.\n\n*** ** * ** ***\n\n### `set``Italic(italic)`\n\nSets whether or not the text is italic.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|-----------|------------------------------------|\n| `italic` | `Boolean` | Whether or not the text is italic. |\n\n#### Return\n\n\n[TextStyleBuilder](#) --- The builder for chaining.\n\n*** ** * ** ***\n\n### `set``Strikethrough(strikethrough)`\n\nSets whether or not the text has strikethrough.\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------------|-----------|--------------------------------------------|\n| `strikethrough` | `Boolean` | Whether or not the text has strikethrough. |\n\n#### Return\n\n\n[TextStyleBuilder](#) --- The builder for chaining.\n\n*** ** * ** ***\n\n### `set``Underline(underline)`\n\nSets whether or not the text is underlined.\n\n#### Parameters\n\n| Name | Type | Description |\n|-------------|-----------|----------------------------------------|\n| `underline` | `Boolean` | Whether or not the text is underlined. |\n\n#### Return\n\n\n[TextStyleBuilder](#) --- The builder for chaining."]]