Class

TextComponent

TextComponent

Component which maps a text.

Since:
  • 5.0

Extends

Methods

addBullet(bulletText) → {TextComponent}

Adds a bullet point to the component.

This implicitly sets the default bullet style if the component is empty, which will render the whole component as a bullet list as a result.

Available in ppt and word reporting only!

Parameters:
Name Type Description
bulletText string

The text of the bullet point to add.

The component itself.

Example
component
  .addBullet('Trash panda')
  .addBullet('Panda whale')
  .addBullet('Fart squirrel');
  // • Trash panda
  // • Panda whale
  // • Fart squirrel

asBulletList(styleopt) → {TextComponent}

Renders the component as a bullet list with every paragraph marking a separate bullet point.

Note that in powerpoint paragraphs are separated by carriage return ('\r') characters. New line ("\n") will not result in a new bullet point. c Bullets can can have one of the following styles:
• BULLET
‣ TRIANGULAR_BULLET
◦ WHITE_BULLET
⁃ HYPHEN_BULLET
⁌ BLACK_LEFTWARDS_BULLET
⁍ BLACK_RIGHTWARDS_BULLET
∙ BULLET_OPERATOR

Available in ppt and word reporting only!

Parameters:
Name Type Attributes Default Description
style 'BULLET' | 'TRIANGULAR_BULLET' | 'WHITE_BULLET' | 'HYPHEN_BULLET' | 'BLACK_LEFTWARDS_BULLET' | 'BLACK_RIGHTWARDS_BULLET' | 'BULLET_OPERATOR' <optional>
'BULLET'

The style of the bullets to use. This is case insensitive.

The component itself.

Examples
component
  .withText('Akatosh\rKynareth\rArkay')
  .asBulletList();
  // • Akatosh
  // • Kynareth
  // • Arkay
component
  .asBulletList('BLACK_RIGHTWARDS_BULLET')
  .addBullet('Fox McCloud')
  .addBullet('Falco Lombardi')
  .addBullet('Slippy Toad');
  // ⁍ Fox McCloud
  // ⁍ Falco Lombardi
  // ⁍ Slippy Toad

asHtml(embeddingPageopt) → {TextComponent}

Interprets and renders html elements contained in the content of the component.

Available in word reporting only!

Parameters:
Name Type Attributes Default Description
embeddingPage WrappedPage <optional>
null

The embedding page to render rich text embedded widgets from.

Since:
  • 5.2

The component itself.

Example
component
  .withText('<div style="background-color: red; color: white;">They're taking the hobbits to Isengard!</div>')
  .asHtml();

bold(boldopt) → {TextComponent}

Sets whether the text of the component shall appear bold or not.

Parameters:
Name Type Attributes Default Description
bold boolean <optional>
true

Whether the effect shall be applied or not.

The component itself.

copy() → {Component}

Create a mutable copy of the component.

This will copy only the component, not the actual shape in the template.

Inherited From:

Mutable copy of the component

Component

filterHtml() → {TextComponent}

Filters the text of the component and removes any HTML from it.

The component itself.

Example
component
  .withText('<div><p>Faust: Siehst du den schwarzen Hund durch Saat und Stoppel streifen?</p> <p>Wagner: Ich sah ihn lange schon, nicht wichtig schien er mir.</p></div>');
// Faust: Siehst du den schwarzen Hund durch Saat und Stoppel streifen?
// Wagner: Ich sah ihn lange schon, nicht wichtig schien er mir.

hide() → {Component}

Hides the component. Short for #withHidden(true)

Available in ppt and word reporting only!

Inherited From:

The component itself.

Component

italic(italicopt) → {TextComponent}

Sets whether the text of the component shall appear italic or not.

Parameters:
Name Type Attributes Default Description
italic boolean <optional>
true

Whether the effect shall be applied or not.

The component itself.

moveX(xPosition) → {Component}

Moves the component on the x axis relative to its current position where a positive number will move to the right and a negative to the left.

The used unit may depend on the report type. PowerPoint eg. uses "pt" as the default unit (where 1 pt usually ≈1 in).

Available in ppt reporting only!

Parameters:
Name Type Description
xPosition number

The amount to move the component on the x axis. Set to null to unset and use presentation settings.

Inherited From:

The component itself.

Component

moveY(yPosition) → {Component}

Moves the component on the y axis relative to its current position where a positive number will move to the bottom and a negative to the top.

The used unit may depend on the report type. PowerPoint eg. uses "pt" as the default unit (where 1 pt usually ≈1 in).

Available in ppt reporting only!

Parameters:
Name Type Description
yPosition number

The amount to move the component on the y axis. Set to null to unset and use presentation settings.

Inherited From:

The component itself.

Component

strikeThrough(strikeThroughopt) → {TextComponent}

Sets whether the text of the component shall appear stricken through or not.

Parameters:
Name Type Attributes Default Description
strikeThrough boolean <optional>
true

Whether the effect shall be applied or not.

The component itself.

underline(underlineopt) → {TextComponent}

Sets whether the text of the component shall appear underlined or not.

Parameters:
Name Type Attributes Default Description
underline boolean <optional>
true

Whether the effect shall be applied or not.

The component itself.

withBackgroundColor(color) → {Component}

Sets the background color of the component.

Parameters:
Name Type Description
color string

A string that represents a 24-bit opaque color.

Inherited From:

The component itself.

Component

withBorder(thickness, r, g, b) → {Component}

Sets the border of a component.

Parameters:
Name Type Description
thickness number

Thickness of the border in pt

r number

The red value of the border color.

g number

The green value of the border color.

b number

The blue value of the border color.

Inherited From:

The component itself.

Component

withBorder(thickness, color) → {Component}

Sets the border of a component.

Parameters:
Name Type Description
thickness number

Thickness of the border in pt

color string

A string that represents a 24-bit opaque color.

Inherited From:

The component itself.

Component

withConfig(config) → {TextComponent}

Sets up the component with the given configuration.

Parameters:
Name Type Description
config TextConfig

The configuration to apply.

The component itself.

withFont(fontName) → {TextComponent}

Sets the font used by the component.

Parameters:
Name Type Description
fontName string

The name of the font to use. Can be null to not overwrite the template font.

The component itself.

withFontSize(size) → {TextComponent}

Sets the font size of the component.

Parameters:
Name Type Description
size number

The font size (in the default font size unit, pt).

The component itself.

withHidden(hidden) → {Component}

Set the visibility of the component.

Available in ppt and word reporting only!

Parameters:
Name Type Description
hidden boolean

Whether the component shall be visible or not.

Inherited From:

The component itself.

Component

withLimit(length) → {TextComponent}

Truncates the text of the component to a given length. Negative values are invalid for this method. A value greater 0 (zero) will enable truncation.

If the component is also set to display a bullet list then every bullet will be truncated separately.

Parameters:
Name Type Description
length number

The length after which the text shall be truncated. Truncation will only happen if the given limit is exceeded (exclusive).

The component itself.

Examples
component
  .withText('Hello there. - General Kenobi.')
  .withLimit(11);
// 'Hello there...'
component
  .addBullet('Hello there')
  .addBullet('General Kenobi')
  .asBulletList()
  .withLimit(8);
// • Hello th...
// • General ...

withText(text) → {TextComponent}

Sets the text to display to the given value.

Parameters:
Name Type Description
text string

Text to set.

The component itself.

withTextColor(r, g, b) → {TextComponent}

Sets the color of the displayed text

Parameters:
Name Type Description
r number

The red value of the color.

g number

The green value of the color.

b number

The blue value of the color.

The component itself.

withTextColor(color) → {TextComponent}

Sets the color of the displayed text

Parameters:
Name Type Description
color string

The string representation of a 24-bit opaque color (e.g. "#FF00AA").

The component itself.

withX(xPosition) → {Component}

Sets the x coordinate of the component on the slide where 0 represents the leftmost border of the visible area. Values may exceed the boundaries (negative & positive) which will result in the component being placed outside the viewport.

The used unit may depend on the report type. PowerPoint eg. uses "pt" as the default unit (where 1 pt usually ≈1 in).

Available in ppt reporting only!

Parameters:
Name Type Description
xPosition number

The x coordinate of the component. Set to null to unset and use presentation settings.

Inherited From:

The component itself.

Component

withY(yPosition) → {Component}

Sets the x coordinate of the component on the slide where 0 represents the topmost border of the visible area. Values may exceed the boundaries (negative & positive) which will result in the component being placed outside the viewport.

The used unit may depend on the report type. PowerPoint eg. uses "pt" as the default unit (where 1 pt usually ≈1 in).

Available in ppt reporting only!

Parameters:
Name Type Description
yPosition number

The y coordinate of the component. Set to null to unset and use presentation settings.

Inherited From:

The component itself.

Component