This is a really simple question, and I am probably missing something obvious, but using JSL, how do I get a word in the middle of a textbox to appear in bold?
With the cursor on top of the text box, right click, then select Font and then Font Style "Bold".
I wrote my question in a hurry and perhaps I was not clear enough.
I am writing a textbox in JSL and want a single word within that to appear in bold:
textbox("blah blah blah blah blah blah");
If I use:
textbox("blah blah blah blah blah blah", set font style("Bold"));
then this makes the whole box bold, when I only want one word in bold.
Is this possible?
Unless there's some way of inserting control characters into the text itself, the only way I can think of approaching it would be to break down the sentence into segments, each of them inside a different text box, and then just string them together something like the following:
tba = text box(" This ", set font style("italic"));
tbb = text box("is a ");
tbc = text box("very ", set font style("bold"));
tbd = text box("tricky question. ");
nw1 = new window("Demo", hlistbox(tba, tbb, tbc, tbd));
If you don't know how many changes in style you're going to have in advance, you won't know how many text boxes you're going to need, but you could get around that by doing something like this, in which I've also added a border box with lines on all sides around the text:
textlist = {" This ", "is a ", "very ", "tricky question. "};
stylelist = {"italic", "", "bold", ""};
hlb = hlistbox();
for(i=1, i<=nItems(textlist), i++,
hlb << append(textbox(textlist, set font style(stylelist)))
);
nw2 = new window("Demo2", borderbox(hlb, << sides(15)));
Is that of any use?
Thanks - that is really helpful. I had a sneaking suspicion it was going to be something like that, but I hadn't managed to figure out the 'how'.
This is a very delayed reply, but I thought I should put it here in case anyone else has a similar question and comes across this thread.
In JMP 11, the textbox() command can accept 3 HTML markups - bold, italic, underlined.
From the scripting index:
win = New Window( "Example", text = Text Box( "Example Text" ) );
text << setText(
"This is <b>bold</b> text. This is <i>italic</i> text. This is <u>underlined</u> text. This is <b><i><u>bold, italic, underlined</u></i></b> text."
);
text << markup;
Here's a one-line text box script: TB_MyTextBox = text box("My example <b>bold</b> text can also be <i>italicized</i> and <u>underlined</u>, as in <b><i><u>this example</u></i></b>.", <<Markup),
When combining, remember that order of the HTML markups matters. <m1><m2>text</m1></m2> will not work - the markups must be 'closed' in the opposite order they are opened, so </m2></m1>.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: