Jump to content

TextStyleAdd Problem


This topic is 7141 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I can't seem to get the TextStyleAdd function to recognize styles when referenced from a text field, placing the style directly in the function works fine, but referencing a field produces no change.

Am I missing something?

Here's the Calc I'm using basically taken from the example in Help:

TextStyleAdd ( TextStyleAdd ( FormatText::Txt1 ; Plain ) ; FormatText::FontStyle)

Where FormatText::FontStyle is a text field.

Link to comment
Share on other sites

The styles are not text strings, they are numbers, the calculation is interpreting them as named constants.

If you play around with it a little, you'll notice:

Plain = 0

SmallCaps = 2

TitleCase = 48

Bold = 256

Italic = 512

etc.

So, when the help example states:

TextStyleAdd( titleField; SmallCaps + TitleCase )

you could instead use:

TextStyleAdd( titleField; 2 + 48 )

as well.

You could make your calculation work the way you'd like by changing it to:

TextStyleAdd ( TextStyleAdd ( FormatText::Txt1 ; Plain ) ; Evaluate( FormatText::FontStyle) )

and Evaluate() will determine the correct style-number from the name given.

Link to comment
Share on other sites

This topic is 7141 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.