Search and Replace |
Use the Search and Replace dialog to create, modify, and test actions for the search and replace transform. You can open this dialog by using one of the following methods:
Click next to the Search and Replace option on the Transforms tab of the Data Sources property page.
Click next to the Search and Replace option on the Human Readable property page.
Depending on what kind of transform you want to perform, the action can consist of the text to be searched for; instructions to insert, replace, or delete that text; and the search method to be used. You can also specify the code page to be used. The actions are performed in the order in which they appear in the Actions list, and each action makes a complete pass through the trigger file before the next action is started.
You can transfer the list of actions between installed instances of BarTender by using the Import and Export options.
The following options are available.
Actions: Lists the search and replace actions that you have configured. The following options are available in the toolbar at the bottom of the list:
Adds a new action to the list.
Removes the selected action from the list.
Removes the selected action from the list and places a copy of the action on the Clipboard.
Copies the selected action to the Clipboard.
Pastes a copy of the action that is on the Clipboard into the action list.
Moves the selected action up one position in the list.
Moves the selected action down one position in the list.
|
You can also access these commands by right-clicking the Actions list. |
Import: Opens the Import Action List dialog so that you can load an actions list that was previously saved as an XML file in another installed instance of BarTender.
Export: Opens the Export Action List dialog so that you can save the current actions list in an XML file.
Action Options: Specifies the configuration for the action that is selected in the Actions list. The following options are available:
Description: Specifies a descriptive name for the action.
Action: Specifies what kind of transform action is to be performed.
Search for: Specifies the text to search for in the selected data source. To enter non-typable characters, such as carriage returns, into the search field, click , and then select the character that you want.
Syntax: Specifies the syntax that the search operation uses for the text in the Search Text field. Available options include literal, regular expression, and wildcard.
First Occurrence Only: Specifies that the action is performed only on the first occurrence of the search text.
Replace with: Specifies the text that replaces the search text in the selected data source. To enter non-typable characters into the search field, click , and then select the character that you want. Available when Action includes a "replace" or "delete" operation.
Insert: Specifies the text that is inserted before or after the search text in the selected data source. To enter non-typable characters into the search field, click , and then select the character that you want. Available when Action includes an "insert" operation.
Test: Opens the Test Action List dialog, which you can use to test the list of actions and confirm that they behave the way that you want. In this dialog, you can specify the location of a sample file that contains the data in the data source and export the file to a destination file. The actions are performed in the order that they appear in the Actions list.
You can use the search and replace transform to associate data-sourced colors with objects on your template. If the database that your document is connected to does not contain color information, you can use the search and replace transform to map each value in a database field to a unique color. The transform searches for the value of the field that you specify and replaces it with the color that you specify.
Consider the following example:
Your company produces membership cards for a local gym. Members can have monthly, annual, or unlimited membership levels, and you want a color-coded stripe that corresponds to each level to appear on the cards. You have connected to a database that includes a "MemberLevel" field, and you want to associate this field with a different color for each membership level. In this case, you can use the search and replace transform to search for each membership level in the database and then map a different color to each level.
To do this, follow these steps:
Connect your document to a database that contains a MemberLevel field that includes the following values: Monthly, Annual, and Unlimited.
Add a rectangular shape object to the template for the stripe.
Double-click the rectangle to open the Box Properties dialog.
Configure the rectangle's fill properties to use color that is sourced by using the search and replace transform. To do this, follow these steps:
In the Fill Properties area, click the Color option to open the Color Picker.
Click to expand the Color Picker if it is not already expanded.
On the Standard or Custom tab, click Set via data source.
In the Data Sourced Color dialog, make sure that Get color from data source is selected, and then click Data Source in the left navigation pane.
On the Data Source tab, click for the Type field, and then use the Change Data Source Type wizard to change the data source type to Database Field. Click Next.
On the Database Field page of the Change Data Source Type wizard, select the MemberLevel field in the Field name list, and then click Finish.
In the Data Sourced Color dialog, click the Transforms tab.
Click next to the Search and replace field to open the Search and Replace dialog.
On the toolbar at the bottom of the Actions list, click .
In the Actions Options area, configure the following properties:
In the Description field, add a descriptive name for the action.
In the Action list, make sure that Search and Replace is selected.
In the Search for field, enter the value of the MemberLevel database field that you want to search for. For example, enter "Monthly". Make sure that the term that you enter is an exact match for the term in the database that you want to search for.
In the Replace with field, enter the name or hexadecimal value of the color that you want to use for the Monthly membership level. (Supported colors are listed in the "Predefined Colors" section that follows.) If you use the hexadecimal value, do not include the number sign (#).
For Pantone colors, use either the "friendly" name (such as "Electric Purple") or the technical name (such as "PANTONE 18-3640 TN"). You can view a list of these colors by clicking the PANTONE tab of the Color Picker.
Repeat steps i and j for the other values in the MemberLevel database field.
Click OK to close the Search and Replace dialog.
Click OK to close the Data Sourced Color dialog.
As needed, repeat this procedure for the line properties of the rectangle. Otherwise, click Close to close the Box Properties dialog.
The following table lists supported predefined colors and their hexadecimal values. To view a list of supported Pantone colors, click the PANTONE tab in the Color Picker.
Color name |
HEX value |
Color name |
HEX value |
|||
---|---|---|---|---|---|---|
AliceBlue | #F0F8FF | LightSalmon | #FFA07A | |||
AntiqueWhite | #FAEBD7 | LightSeaGreen | #20B2AA | |||
Aqua | #00FFFF | LightSkyBlue | #87CEFA | |||
Aquamarine | #7FFFD4 | LightSlateGray | #778899 | |||
Azure | #F0FFFF | LightSteelBlue | #B0C4DE | |||
Beige | #F5F5DC | LightYellow | #FFFFE0 | |||
Bisque | #FFE4C4 | Lime | #00FF00 | |||
Black | #000000 | LimeGreen | #32CD32 | |||
BlanchedAlmond | #FFEBCD | Linen | #FAF0E6 | |||
Blue | #0000FF | Magenta | #FF00FF | |||
BlueViolet | #8A2BE2 | Maroon | #800000 | |||
Brown | #A52A2A | MediumAquamarine | #66CDAA | |||
BurlyWood | #DEB887 | MediumBlue | #0000CD | |||
CadetBlue | #5F9EA0 | MediumOrchid | #BA55D3 | |||
Chartreuse | #7FFF00 | MediumPurple | #9370DB | |||
Chocolate | #D2691E | MediumSeaGreen | #3CB371 | |||
Coral | #FF7F50 | MediumSlateBlue | #7B68EE | |||
CornflowerBlue | #6495ED | MediumSpringGreen | #00FA9A | |||
Cornsilk | #FFF8DC | MediumTurquoise | #48D1CC | |||
Crimson | #DC143C | MediumVioletRed | #C71585 | |||
Cyan | #00FFFF | MidnightBlue | #191970 | |||
DarkBlue | #00008B | MintCream | #F5FFFA | |||
DarkCyan | #008B8B | MistyRose | #FFE4E1 | |||
DarkGoldenrod | #B8860B | Moccasin | #FFE4B5 | |||
DarkGray | #A9A9A9 | NavajoWhite | #FFDEAD | |||
DarkGreen | #006400 | Navy | #000080 | |||
DarkKhaki | #BDB76B | OldLace | #FDF5E6 | |||
DarkMagenta | #8B008B | Olive | #808000 | |||
DarkOliveGreen | #556B2F | OliveDrab | #6B8E23 | |||
DarkOrange | #FF8C00 | Orange | #FFA500 | |||
DarkOrchid | #9932CC | OrangeRed | #FF4500 | |||
DarkRed | #8B0000 | Orchid | #DA70D6 | |||
DarkSalmon | #E9967A | PaleGoldenrod | #EEE8AA | |||
DarkSeaGreen | #8FBC8F | PaleGreen | #98FB98 | |||
DarkSlateBlue | #483D8B | PaleTurquoise | #AFEEEE | |||
DarkSlateGray | #2F4F4F | PaleVioletRed | #DB7093 | |||
DarkTurquoise | #00CED1 | PapayaWhip | #FFEFD5 | |||
DarkViolet | #9400D3 | PeachPuff | #FFDAB9 | |||
DeepPink | #FF1493 | Peru | #CD853F | |||
DeepSkyBlue | #00BFFF | Pink | #FFC0CB | |||
DimGray | #696969 | Plum | #DDA0DD | |||
DodgerBlue | #1E90FF | PowderBlue | #B0E0E6 | |||
FireBrick | #B22222 | Purple | #800080 | |||
FloralWhite | #FFFAF0 | Red | #FF0000 | |||
ForestGreen | #228B22 | RosyBrown | #BC8F8F | |||
Fuchsia | #FF00FF | RoyalBlue | #4169E1 | |||
Gainsboro | #DCDCDC | SaddleBrown | #8B4513 | |||
GhostWhite | #F8F8FF | Salmon | #FA8072 | |||
Gold | #FFD700 | SandyBrown | #F4A460 | |||
Goldenrod | #DAA520 | SeaGreen | #2E8B57 | |||
Gray | #808080 | Seashell | #FFF5EE | |||
Green | #008000 | Sienna | #A0522D | |||
GreenYellow | #ADFF2F | Silver | #C0C0C0 | |||
Honeydew | #F0FFF0 | SkyBlue | #87CEEB | |||
HotPink | #FF69B4 | SlateBlue | #6A5ACD | |||
IndianRed | #CD5C5C | SlateGray | #708090 | |||
Indigo | #4B0082 | Snow | #FFFAFA | |||
Ivory | #FFFFF0 | SpringGreen | #00FF7F | |||
Khaki | #F0E68C | SteelBlue | #4682B4 | |||
Lavender | #E6E6FA | Tan | #D2B48C | |||
LavenderBlush | #FFF0F5 | Teal | #008080 | |||
LawnGreen | #7CFC00 | Thistle | #D8BFD8 | |||
LemonChiffon | #FFFACD | Tomato | #FF6347 | |||
LightBlue | #ADD8E6 | Turquoise | #40E0D0 | |||
LightCoral | #F08080 | Violet | #EE82EE | |||
LightCyan | #E0FFFF | Wheat | #F5DEB3 | |||
LightGoldenrodYellow | #FAFAD2 | White | #FFFFFF | |||
LightGray | #D3D3D3 | WhiteSmoke | #F5F5F5 | |||
LightGreen | #90EE90 | Yellow | #FFFF00 | |||
LightPink | #FFB6C1 | YellowGreen | #9ACD32 |
You can use the search and replace transform to add soft hyphens to your text. Soft hyphens are invisible formatting characters that you can use to dynamically break words at any defined hyphenation point.
Consider the following example:
Your company produces labels that use one of several different languages to convey the same information. You define the hyphens for the text that is to be inserted in the text object so that the hyphenation will be correct for each language as it is printed, no matter the size or shape of the text object.
For example, for the German label, you want the following text to appear:
Ab dem 24. August 2023 muss vor der industriellen oder gewerblichen Verwendung eine angemessene Schulung erfolgen.
You use a backslash (\) and hyphen (-) combination to define hyphenation points for this text as follows:
Ab dem 24. Au\-gust 2023 muss vor der in\-dus\-tri\-ellen oder ge\-werb\-lich\-en Ver-wen\-dung ei\-ne an\-ge\-mes\-sene Schu\-lung er\-fol\-gen.
Then, you want to replace these hyphenation placeholders with a Unicode soft hyphen. When you do this, the printed label shows only those hyphens that are necessary for the size and shape of the printed text object and hides the others.
To do this, follow these steps:
Add a normal wrapped text object to your BarTender template, and then enter the text that contains the backslash and hyphen combinations.
Double-click the text object to open the Text Properties dialog.
On the Transforms tab, click to the right of the Search and replace field.
On the actions toolbar, click to create a new action.
In the Action Options area, configure the settings as follows:
In the Description field, enter an optional description of the action.
In the Action list, select Search and Replace.
In the Search for box, enter a backslash and hyphen combination (\-).
In the Syntax list, select Literal.
Click inside the Replace with box, and then press ALT+0173. Notice that no character appears in the box, but the text in the text object adjusts to replace the backslash and hyphen combinations with soft hyphens.
Click OK to close the Search and Replace dialog.
Click Close to close the Text Properties dialog.
On the BarTender template, you can resize the text object to observe how the hyphenation changes dynamically.
Related Topics