auto_ReplaceTextΒΆ

auto_ReplaceText executes a find and replace command. The function searches in text objects and axis titles for the find text and replaces it with the specified text.

hText = auto_ReplaceText(ssFind, ssReplace)
hText = auto_ReplaceText(ssFind, ssReplace, bEdit)
hText = auto_ReplaceText(ssFind, rsReplace)
hText = auto_ReplaceText(ssFind, rsReplace, bEdit)

Return Value

hText is the handle of the text object where the find text was found. If the find text was found in more than one text object, the handle of the last object is returned. The function returns 0 if the find text could not be found.

Parameters

ssFind

ssFind is the text that should be replaced. The text should be enclosed in $ symbols, for example: $User$.

ssReplace

ssReplace is the new text.

rsReplace

rsReplace is a real value. The value will be converted to a string.

bEdit

If bEdit is TRUE (1) the placeholder text will be copied from the text field into the name field. If bEdit is FALSE (0) the placeholder text will not be copied from the text field into the name field. Default value is FALSE. If the placeholder is copied into the name field the Edit Object=>Placeholder-Dialog dialog will display the text.

Comment

If you insert a placeholder into the text element, the name field must be empty. Placeholders in name field have a higher priority than placeholders in the text element. If the text field contains several placeholders, the text is automatically copied into the name field.

Example

Example 1:

auto_LoadTemplate(GetRootDirectory() + "/template/tpl1.ipw")
auto_ReplaceText("$OPERATOR$", "Mr. Miller")
auto_ReplaceText("$GREEKLETTERS$", "\a\b\c\A\B\C")
auto_ReplaceText("$TWOLINES$", "Rows 1\r\nZeile2")
rsValue = 123.23
auto_ReplaceText("$Value$", sprintf("%.2lf", rsValue))
auto_UpdatePage()

id-1071328