Change text size of words in ( ) フォローする

0
Avatar
Tim Kirton

Hello,

I was wondering if anyone could help me.

Our label get its information from a access data base.

For the name of the product. I would like to find words inside the ( )s and lower the font size.

Example of what i mean:

Main name

(Second name)

At the moment its is.

Main name

(second name)

1 コメント

0
Avatar
Pete Thane
コメントアクション Permalink

You will need to use a VB script routine to perform part of this and as the data comes from a database it will need to be an Event Controlled Script and OnNewRecord. 

In the screenshots below I have used a Named Data Source called "OriginalData" but for your code you would need to link to the correct database field.

 

When a database is linked the column in the right will include a Database Fields option and in there you will see all your fields, similar to the Named Data Sources shown in the above screen.

Once you have selected the OnNewRecord option in the column on the left you will then need to add the following code in the central box

Value = Format.NamedSubStrings("OriginalInfo").Value 

Value1 = Instr(Value,"(")

Value = Left(Value,(Value1-1))

(NOTE: for the top line type "Value = " and then double click on the correct database field in the right hand column to add the rest of this line)

Now click close. You now need to add a second substring to allow for the text in brackets, to do this use the Copy and Paste buttons highlighted below to make a duplicate of the field above. After that you need to make sure this 2nd field is highlighted and then press the Edit with Script Editor button to amend the VB code for that

 

For the second substring amend the VB as follows

Value = Format.NamedSubStrings("OriginalInfo").Value

Value1 = Instr(Value,"(")

Value2 = Len(Value)

Value3 = Value2-Value1

Value = Right(Value,Value3)

 

After you press the Close button, next click on the Transforms tab and the Truncation button and click to discard 1 character from the right (which will remove the closing bracket.


You now have one field made of two substrings. In 2019 in order to give each field a different font type or size you need to highlight the substring you want and then adjust the font and/or size using the font selection tools at the top left of the screen.   

 

 I am guessing you may want the smaller text to appear on a second line as you have shown above. If this is the case you need to make sure your text field is a Text Wrapped field and you will need to an a Transforms>Suffix> CR as per the image below

 

I hope this helps

 

サインインしてコメントを残してください。