Class ListStyle
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ListStyle
การจัดรูปแบบรายการสำหรับช่วงข้อความ
เมธอด
วิธีการ | ประเภทการแสดงผล | รายละเอียดแบบย่อ |
applyListPreset(listPreset) | ListStyle | ใช้ ListPreset ที่ระบุกับย่อหน้าทั้งหมดที่ทับซ้อนกับข้อความ |
getGlyph() | String | แสดงผลแบบอักษรที่ผ่านการจัดการแสดงผลสำหรับข้อความ |
getList() | List | แสดงผล List ที่ข้อความอยู่ หรือ null หากข้อความไม่อยู่ในรายการ หรือมีเพียงบางส่วนของข้อความที่อยู่ในรายการ หรือข้อความอยู่ในหลายรายการ |
getNestingLevel() | Integer | แสดงผลระดับการฝังของข้อความโดยอิงจาก 0 |
isInList() | Boolean | แสดงผลเป็น true หากข้อความอยู่ในรายการเพียงรายการเดียว false หากข้อความไม่อยู่ในรายการใดเลย และ null หากมีเพียงบางส่วนของข้อความอยู่ในรายการ หรือหากข้อความอยู่ในหลายรายการ |
removeFromList() | ListStyle | นำย่อหน้าที่อยู่ซ้อนทับกับข้อความออกจากรายการ |
เอกสารประกอบโดยละเอียด
applyListPreset(listPreset)
ใช้ ListPreset
ที่ระบุกับย่อหน้าทั้งหมดที่ทับซ้อนกับข้อความ
ระดับการฝังของย่อหน้าแต่ละย่อหน้าจะกำหนดโดยการนับแท็บนำหน้าของแต่ละย่อหน้า ระบบจะใช้วิธีนี้นำแท็บนำหน้าออกเพื่อไม่ให้มีช่องว่างมากเกินไประหว่างอักขระกับย่อหน้าที่เกี่ยวข้อง
หากย่อหน้าที่อยู่ก่อนหน้าย่อหน้าที่จะอัปเดตอยู่ใน List
ที่มีรายการที่กำหนดไว้ล่วงหน้าซึ่งตรงกันและย่อหน้าที่จะอัปเดตไม่ได้อยู่ในรายการอื่น ระบบจะเพิ่มย่อหน้าที่จะอัปเดตลงในรายการก่อนหน้านั้น
พารามิเตอร์
รีเทิร์น
ListStyle
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getGlyph()
แสดงผลแบบอักษรที่ผ่านการจัดการแสดงผลสำหรับข้อความ แสดงผล null
หากข้อความมีความยาวมากกว่า 1 ย่อหน้าหรือข้อความไม่ได้อยู่ในรายการ
รีเทิร์น
String
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getList()
แสดงผล List
ที่ข้อความอยู่ หรือ null
หากข้อความไม่อยู่ในรายการ หรือมีเพียงบางส่วนของข้อความที่อยู่ในรายการ หรือข้อความอยู่ในหลายรายการ เรียกใช้ isInList()
เพื่อระบุว่าข้อความอยู่ในรายการหรือไม่
รีเทิร์น
List
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
getNestingLevel()
แสดงผลระดับการฝังของข้อความโดยอิงจาก 0 แสดงผล null
หากข้อความไม่ได้อยู่ในลิสต์หรือมีค่าผสม
รีเทิร์น
Integer
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
isInList()
แสดงผลเป็น true
หากข้อความอยู่ในรายการเพียงรายการเดียว false
หากข้อความไม่อยู่ในรายการใดเลย และ null
หากมีเพียงบางส่วนของข้อความอยู่ในรายการ หรือหากข้อความอยู่ในหลายรายการ
รีเทิร์น
Boolean
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
removeFromList()
นำย่อหน้าที่อยู่ซ้อนทับกับข้อความออกจากรายการ
ระบบจะคงระดับการฝังของย่อหน้าแต่ละรายการไว้ด้วยการเพิ่มการเยื้องไว้ที่ต้นของย่อหน้าที่เกี่ยวข้อง
รีเทิร์น
ListStyle
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/presentations.currentonly
-
https://www.googleapis.com/auth/presentations
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003e\u003ccode\u003eListStyle\u003c/code\u003e encompasses methods to manipulate the styling and structure of lists within text ranges in Google Slides.\u003c/p\u003e\n"],["\u003cp\u003eIt provides functionalities to apply list presets, determine nesting levels, and check if text resides within a list.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve the rendered glyph or the associated \u003ccode\u003eList\u003c/code\u003e object for further manipulation.\u003c/p\u003e\n"],["\u003cp\u003eMethods are available to remove text from lists while preserving visual indentation.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization with specific scopes is required to utilize these methods in your scripts.\u003c/p\u003e\n"]]],["The `ListStyle` object manages text list formatting. Key actions include: applying a `ListPreset` to paragraphs, which also adjusts nesting levels by removing leading tabs; retrieving the rendered glyph, the associated `List` object, or the nesting level. It can also check if the text is within a list, and remove text from any existing list. Additionally, removing text from a list visually preserves nesting through indenting. Each method requires specific authorization scopes.\n"],null,["# Class ListStyle\n\nListStyle\n\nThe list styling for a range of text. \n\n### Methods\n\n| Method | Return type | Brief description |\n|-------------------------------------------------------------|--------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [applyListPreset(listPreset)](#applyListPreset(ListPreset)) | [ListStyle](#) | Applies the specified [ListPreset](/apps-script/reference/slides/list-preset) to all of the paragraphs that overlap with the text. |\n| [getGlyph()](#getGlyph()) | `String` | Returns the rendered glyph for the text. |\n| [getList()](#getList()) | [List](/apps-script/reference/slides/list) | Returns the [List](/apps-script/reference/slides/list) the text is in, or `null` if none of the text is in a list, or part of the text is in a list, or the text is in multiple lists. |\n| [getNestingLevel()](#getNestingLevel()) | `Integer` | Returns the 0-based nesting level of the text. |\n| [isInList()](#isInList()) | `Boolean` | Returns `true` if the text is in exactly one list, `false` if none of the text is in a list, and `null` if only some of the text is in a list or if the text is in multiple lists. |\n| [removeFromList()](#removeFromList()) | [ListStyle](#) | Removes the paragraphs that overlap with the text from any lists. |\n\nDetailed documentation\n----------------------\n\n### `apply``List``Preset(listPreset)`\n\nApplies the specified [ListPreset](/apps-script/reference/slides/list-preset) to all of the paragraphs that overlap with the text.\n\nThe nesting level of each paragraph is determined by counting leading tabs in front of each\nparagraph. To avoid excess space between the glyphs and the corresponding paragraph, these\nleading tabs are removed by this method.\n\nIf the paragraph immediately before paragraphs being updated is in a [List](/apps-script/reference/slides/list) with a\nmatching list preset and the paragraphs being updated are not already in a different list, the\nparagraphs being updated are added to that preceding list.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------------|---------------------------------------------------------|-------------|\n| `list``Preset` | [ListPreset](/apps-script/reference/slides/list-preset) | |\n\n#### Return\n\n\n[ListStyle](#)\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/presentations.currentonly`\n- `https://www.googleapis.com/auth/presentations`\n\n*** ** * ** ***\n\n### `get``Glyph()`\n\nReturns the rendered glyph for the text. Returns `null` if the text spans more than one\nparagraph or the text is not in a list.\n\n#### Return\n\n\n`String`\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/presentations.currentonly`\n- `https://www.googleapis.com/auth/presentations`\n\n*** ** * ** ***\n\n### `get``List()`\n\nReturns the [List](/apps-script/reference/slides/list) the text is in, or `null` if none of the text is in a list, or\npart of the text is in a list, or the text is in multiple lists. Call [isInList()](#isInList()) to\ndetermine whether the text is in a list.\n\n#### Return\n\n\n[List](/apps-script/reference/slides/list)\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/presentations.currentonly`\n- `https://www.googleapis.com/auth/presentations`\n\n*** ** * ** ***\n\n### `get``Nesting``Level()`\n\nReturns the 0-based nesting level of the text. Returns `null` if the text is not in a\nlist or there are mixed values.\n\n#### Return\n\n\n`Integer`\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/presentations.currentonly`\n- `https://www.googleapis.com/auth/presentations`\n\n*** ** * ** ***\n\n### `is``In``List()`\n\nReturns `true` if the text is in exactly one list, `false` if none of the text is\nin a list, and `null` if only some of the text is in a list or if the text is in multiple\nlists.\n\n#### Return\n\n\n`Boolean`\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/presentations.currentonly`\n- `https://www.googleapis.com/auth/presentations`\n\n*** ** * ** ***\n\n### `remove``From``List()`\n\nRemoves the paragraphs that overlap with the text from any lists.\n\nThe nesting level of each paragraph is visually preserved by adding indent to the start of\nthe corresponding paragraph.\n\n#### Return\n\n\n[ListStyle](#)\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/presentations.currentonly`\n- `https://www.googleapis.com/auth/presentations`"]]