Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Apply Text Style to Specific Text in a Text Element with Evaluate=True #125

Open
saukif opened this issue Sep 10, 2024 · 4 comments

Comments

@saukif
Copy link

saukif commented Sep 10, 2024

I have a use case where I need to apply bold formatting to a specific part of a text element, like this:
${DisplayNumber} + str(format_date(${CurrentDate}, 'MM/dd/yyyy'))
I want the CurrentDate to appear in bold, while keeping the rest of the text in normal font.

The issue is that when using Evaluate=True to dynamically evaluate the expression, I can't find a way to apply text formatting directly. Using rich text formatting would prevent me from evaluating the expression as intended.

How can I achieve this? Is there a way to style specific parts of the text while still evaluating it correctly?

@alhman
Copy link
Contributor

alhman commented Sep 19, 2024

You can add an additional parameter CurrentDateFormatted which contains the formatted date by evaluating an expression format_datetime(${CurrentDate}, 'MM/dd/yyyy'). Then you can use a rich text element and apply bold formatting to the CurrentDateFormatted parameter.

Alternatively rich text parameters are also supported where you can set a formatted parameter for a rich text element.

@saukif
Copy link
Author

saukif commented Sep 20, 2024

Thank you for the suggestion. However, since adminMode is set to false for our users, they cannot add or modify parameters like CurrentDateFormatted. Is there an alternative approach that works without requiring users to add extra parameters?

@alhman
Copy link
Contributor

alhman commented Sep 23, 2024

Maybe you can add the parameter CurrentDateFormatted to the report template in your backend. Otherwise I don't think there is a solution with your setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@alhman @saukif and others