Object

FormattedText

The object for specifying formatted text content and styling for captions in table cells.

Properties

additions

An array of addition objects that supply additional information for ranges of text in the text property.

This property is ignored when format is set to html.

format
string

The formatting or markup method applied to the text. If format is set to html, neither additions nor inlineTextStyles is supported.

inlineTextStyles

An array specifying ranges of characters and a TextStyle object to apply to each range.

This property is ignored when format is set to html.

text
string
(Required)

The text, including any HTML tags.

textStyle
*

Either a component text style object, or the name string of one of your styles in the ArticleDocument.componentTextStyles object.

type
string
(Required)

The type must be formatted_text.

Discussion

Use a FormattedText object to provide the content and style for text strings used in data tables and as caption descriptors. You can use a FormattedText object for:

  • Row and column headers (the value of the label property in DataDescriptor)

  • Data in JSON tables (the value of a key-value pair in a record in RecordStore)

To apply a style to a FormattedText object, you can use a ComponentTextStyle. You can also use either HTML or InlineTextStyle objects to further customize ranges of text. See Using HTML with Apple News Format.

This object can be used in DataDescriptor, RecordStore, and CaptionDescriptor.

Example

{ "components": [ { "role": "datatable", "data": { "descriptors": [ { "identifier": "id-title", "key": "title", "dataType": "text", "label": "Title" } ], "records": [ { "title": { "type": "formatted_text", "text": "<strong>Name</strong>", "format": "html" } } ] } } ]}

See Also

Table Styles

Defining and Using Table Styles

Apply table styles, such as borders and backgrounds, to the rows, columns, and cells in your HTML and JSON tables.

object TableStyle

The object for defining a style for rows, columns, cells, and headers in a table.

object TableRowStyle

The object for applying styles to rows in a table.

object ConditionalTableRowStyle

The object for applying styles to table rows that meet certain conditions.

object TableRowSelector

The object for defining conditions that will cause a conditional style to be applied to a row.

object TableColumnStyle

The object for applying styles to columns in a table.

object ConditionalTableColumnStyle

The object for applying styles to table columns that meet certain conditions.

object TableColumnSelector

The object for defining conditions that will cause a conditional style to be applied to a column.

object TableCellStyle

The object for applying styles to cells in a table.

object ConditionalTableCellStyle

The object for applying a style to table cells that meet certain conditions.

object TableCellSelector

The object for defining conditions that will cause a conditional style to be applied to a cell.

object TableBorder

The object for setting borders for tables.

object TableStrokeStyle

The object for defining the color, width, and style of a stroke in a table.

object Padding

The object for defining space around the content in a table cell.