• 1 reply
  • Latest Post - ‏2013-02-13T08:56:29Z by SystemAdmin
90 Posts

Pinned topic Rich Text Formatting

‏2013-02-08T13:31:28Z |
Is it possible to perform bolding of the whole sentence in an object. For example, the object will contain the below mentioned text


This is an automated test - disable the ICE if it is connected.

Run the following ATE test script(s):
Name: Test_FMx15_SPEED_10_FAULT
File: Tp_14_SPEED_10.bas

  1. Following steps verifies Test Case HSIT_1378:
1. Reset All Relays.
2. Wait 3 seconds for the Relays to Reset.

  1. Following steps verifies Test Case HSIT_1380:
1. Reset All Relays.
2. Wait 3 seconds for the Relays to Reset.

  1. Following steps verifies Test Case HSIT_1478:
1. Reset All Relays.
2. Wait 3 seconds for the Relays to Reset.


I would like to bold the sentence which contain the text Test Case #, that is basically which starts with the string "#" and ends with the string ":"

So I wrote the script, but it is not able to perform the required operation. But i'm unable to get the thing working. Can someone help me where I made a mistake...

Module m = current
Object o = current
int len = 0
int offset = 0

void richtext_line(string tmp_text, string tmp_text1){
Buffer bodyText = create()
Buffer newText = create()
Buffer tempText = create()
newText = ""
bodyText = richTextWithOle o."Object Text"
print tempStringOf bodyText "\n"
//newText = "{\\b " bodyText "}"
int len1 = 0
int offset1 = 0
string extract_line = ""
findRichText(tempStringOf bodyText, tmp_text, offset, len, false)
tempText = bodyTextoffset1+1:
findRichText(tempStringOf tempText, tmp_text1, offset1, len1, false)
print offset "\n"
print offset1 "\n"
print len "\n"
print len1 "\n"
combine(newText, bodyText, 0, offset-1)

extract_line = bodyTextoffset:offset + offset1
//extract_line = tempText:len1
newText += "{\\b " extract_line "}"
bodyText = bodyTextoffset1+1:
//bodyText = tempTextlen1+1:
combine (newText, bodyText, 0)
/*while ((findRichText(tempStringOf bodyText, tmp_text, offset, len, false)) && (offset > 0))
combine (newText, bodyText, 0, offset-1)
newText += "{\\b " tmp_text "}"
//combine (newText, bodyText, offset+len)
bodyText = bodyTextoffset+len:
offset = 0
combine (newText, bodyText, 0)*/
print tempStringOf newText "\n"
o."Object Text" = richText tempStringOf newText
delete newText
delete bodyText
delete tempText
richtext_line("#", ":")
Updated on 2013-02-13T08:56:29Z at 2013-02-13T08:56:29Z by SystemAdmin
  • SystemAdmin
    3180 Posts

    Re: Rich Text Formatting



    Maybe not how I would have written it, but your code almost works.
    Two small problems:

    1. Your example Object Text does not include '#', so I guess you want your function call to look something like this:

    richtext_line("HSIT", ":")

    2. You have a line where you use the wrong offset variable

    tempText = bodyText[offset1+1:]

    Should be:

    tempText = bodyText[offset+1:]

    or better

    combine(tempText, bodyText, offset+1)



    Updated on 2014-01-06T13:50:34Z at 2014-01-06T13:50:34Z by iron-man