Skip to content
Document Authoring DA  API Docs v1.10.0
npmGitHub

Formatting

Formatting:

Defines text formatting properties that can be applied to document content.

The Formatting type specifies visual styling properties for text. All properties use null to represent “inherited from style”.

When applying formatting via e.g. TextView.setFormatting, you typically use Partial<Formatting> to specify only the properties you want to change.

Apply bold and color to text:

textView.setFormatting({
bold: true,
color: "#ff0000"
});

font: string | null

Font family name (e.g., “Arial”, “Times New Roman”).

Specifies the typeface for the text. null means no explicit font is set (inherits from style).


fontSize: number | null

Font size in points (e.g., 12, 14, 18).

Specifies the size of the text in typographic points (1 point = 1/72 inch). Common sizes are 10-12 for body text, 14-18 for headings. null means no explicit size is set (inherits from style).


bold: boolean | null

Bold text weight.

When true, text is rendered in bold weight. false or null means normal weight.


italic: boolean | null

Italic text style.

When true, text is rendered in italic style. false or null means normal (upright) style.


color: string | null

Text foreground color.

Specifies the color of the text characters. Accepts hex color codes (e.g., “#ff0000” for red, “#0000ff” for blue). null means no explicit color is set (inherits from style).


highlight: string | null

Text background highlight color.

Specifies the background color behind the text (like a highlighter pen). Accepts hex color codes (e.g., “#ffff00” for yellow, “#00ff00” for green). null means no highlight.


strikeout: boolean | null

Strikethrough text decoration.

When true, text is rendered with a horizontal line through the middle.


underline: boolean | null

Underline text decoration.

When true, text is rendered with a line underneath.