• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Text color

Explorer ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

Can javascript be used to change color of part of the text.

Example: today was sunny day.

can word "sunny" be yellow and rest of the text default color (black).

I already tried CTRL+E but text in textbox is dynamic and it reset to default when changed.

TOPICS
Acrobat SDK and JavaScript

Views

70

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 03, 2020 Sep 03, 2020

Yes, this can be done by setting the field as having Rich Text Formatting and then setting its richValue property as an array of Span objects, each one representing a contiguous string of text with identical properties.

In this case you would have 3 spans:

- "today was " would be a Span with black text.

- "sunny" would be a Span with yellow text.

- " day." would be a Span with black text.

Likes

Translate

Translate
Community Expert ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

Yes, this can be done by setting the field as having Rich Text Formatting and then setting its richValue property as an array of Span objects, each one representing a contiguous string of text with identical properties.

In this case you would have 3 spans:

- "today was " would be a Span with black text.

- "sunny" would be a Span with yellow text.

- " day." would be a Span with black text.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

LATEST

Thanks again Try67 you'r the best.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines