Class TextFormatElement

TextFormatElement

A text format element, which can be aTextFormatChip,StyledText,Hyperlink, orListContainer.

Only available for Google Workspace add-ons that extend Google Workspace Studio.

Sample usage:

constsampleChip=AddOnsResponseService.newTextFormatChip().setLabel("Label!");consttextFormatElement=AddOnsResponseService.newTextFormatElement().setTextFormatChip(sampleChip);

Methods

MethodReturn typeBrief description
setHyperlink(hyperlink)TextFormatElementSets the text format element as aHyperlink.
setListContainer(listContainer)TextFormatElementSets the text format element as aListContainer.
setStyledText(styledText)TextFormatElementSets the text format element as aStyledText.
setText(text)TextFormatElementSets the text format element as a text string.
setTextFormatChip(chip)TextFormatElementSets the text format element as aTextFormatChip.

Detailed documentation

setHyperlink(hyperlink)

Sets the text format element as aHyperlink.

Parameters

NameTypeDescription
hyperlinkHyperlinkTheHyperlink of the text format element.

Return

TextFormatElement — This text format element object.


setListContainer(listContainer)

Sets the text format element as aListContainer.

Parameters

NameTypeDescription
listContainerListContainerTheListContainer of the text format element.

Return

TextFormatElement — This text format element object.


setStyledText(styledText)

Sets the text format element as aStyledText.

Parameters

NameTypeDescription
styledTextStyledTextTheStyledText of the text format element.

Return

TextFormatElement — This text format element object.


setText(text)

Sets the text format element as a text string.

Parameters

NameTypeDescription
textStringThe text of the text format element.

Return

TextFormatElement — This text format element object.


setTextFormatChip(chip)

Sets the text format element as aTextFormatChip.

Parameters

NameTypeDescription
chipTextFormatChipTheTextFormatChip of the text format element.

Return

TextFormatElement — This text format element object.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-03 UTC.