Class TextStyle
內容詳盡的說明文件
getFontFamily()
取得文字的字型系列。如果未設定字型系列,或是對應的 RichTextValue
有多個使用不同字型系列的執行,則會傳回 null
。
回攻員
String
:文字的字型系列 (例如「Arial」) 或 null
。
getFontSize()
以點為單位取得文字的字型大小。如果未設定字型大小,或對應的 RichTextValue
有多個不同字型大小的執行序,則會傳回 null
。
回攻員
Integer
:文字的字型大小或 null
。
getForegroundColorObject()
取得文字的字型顏色。如果未設定字型顏色,或是對應的 RichTextValue
有多個具有不同字型顏色的執行次數,則會傳回 null
。
回攻員
Color
:文字或 null
的字型顏色。
isBold()
取得文字是否為粗體。如果未設定粗體字,或對應的 RichTextValue
有多個具有不同粗體設定的執行階段,則會傳回 null
。
回攻員
Boolean
:是否要將儲存格設為粗體,或 null
。
isItalic()
取得儲存格是否斜體。如果未設定斜體,或對應的 RichTextValue
有多個不同斜體設定的執行階段,則會傳回 null
。
回攻員
Boolean
:儲存格是否斜體,或 null
。
isStrikethrough()
取得單元是否已劃掉。如果未設定刪除線,或是對應的 RichTextValue
有多個行,且各自有不同的刪除線設定,則會傳回 null
。
回攻員
Boolean
:是否在儲存格中加上刪除線,或 null
。
isUnderline()
取得單元是否已加底線。如果未設定底線,或是對應的 RichTextValue
有多個行,且每個行有不同的底線設定,則會傳回 null
。
回攻員
Boolean
:是否在儲存格下方加上底線,或 null
。
已淘汰的方法
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-12-03 (世界標準時間)。
[null,null,["上次更新時間:2024-12-03 (世界標準時間)。"],[[["`TextStyle` defines the rendered style of text within a cell in Google Sheets, encompassing attributes like font family, size, color, and formatting."],["It can be linked to a `RichTextValue` for more complex formatting but may return `null` for style properties if the `RichTextValue` has multiple runs with differing styles."],["Developers can use methods like `getFontFamily()`, `getFontSize()`, `isBold()`, etc., to retrieve specific style attributes of the text."],["A `TextStyleBuilder` can be created using the `copy()` method to facilitate the construction of new text styles based on existing ones."],["The `getForegroundColor()` method is deprecated and should be replaced with `getForegroundColorObject()` to retrieve the font color as a `Color` object."]]],["TextStyle defines the visual styling of text within a cell. It interacts with RichTextValue, which handles text segments with varied styles. Core actions include: `copy()` which creates a new TextStyleBuilder with the current style, and getter methods such as `getFontFamily()`, `getFontSize()`, `getForegroundColorObject()`, `isBold()`, `isItalic()`, `isStrikethrough()`, and `isUnderline()`, that each retrieve a specific text style property. Most getter methods may return `null` if the property is not set or varies within a RichTextValue.\n"]]