Consulting

Results 1 to 10 of 10

Thread: Word macro to add html tags to specific parsed phrases

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Word macro to add html tags to specific parsed phrases

    Hi Guys,

    I have a text file that contains over eight thousand of multiple choice questions each is followed by an empty paragraph to separate it from the following question, as per the following example:

    Type: MC
    1) What is the effect of releasing a ball in positive gravity?
    ~ It will fall down. (This is the correct answer) It will retain its mass. (This answer is true but unrelated) It will rise. (This answer is false but related) Its shape will change. (This answer is false and unrelated) It will explode. (This answer is false and unrelated)
    @ IncorrectIt will fall down. (This is the correct answer) It will retain its mass. (This answer is true but unrelated) It will rise. (This answer is false but related) Its shape will change. (This answer is false and unrelated) It will explode. (This answer is false and unrelated)
    *a. It will fall down
    b. It will retain its mass
    c. It will rise
    d. Its shape will change
    e. It will explode

    I'm requested to edit this file by changing the colour of all the items in the two paragraphs that start with "Tilde ~" and "Ampersand @" as long as these phrases exist in the list of alternative answers "a. – k.". In other words to parse the list of alternative answers for each question (in my example a. to e.), and only change their corresponding phrases in the above two paragraphs that start with "~" and "@", by adding relevant html tags. Thus each question will become as follows:

    Type: MC
    1) What is the effect of releasing a ball in positive gravity?
    ~ <font color = "#008000">It will fall down</font>. (This is the correct answer) <font color = "#008000">It will retain its mass</font>. (This answer is true but unrelated) <font color = "#008000">It will rise</font>. (This answer is false but related) <font color = "#008000">Its shape will change</font>. (This answer is false and unrelated) <font color = "#008000">It will explode</font>. (This answer is false and unrelated)
    @ <font color = "#008000">It will fall down</font>. (This is the correct answer) <font color = "#008000">It will retain its mass</font>. (This answer is true but unrelated) <font color = "#008000">It will rise</font>. (This answer is false but related) <font color = "#008000">Its shape will change</font>. (This answer is false and unrelated) <font color = "#008000">It will explode</font>. (This answer is false and unrelated)
    *a. It will fall down
    b. It will retain its mass
    c. It will rise
    d. Its shape will change
    e. It will explode

    .. another question

    .. another question

    Can someone help with this request please? Many thanks in advance.
    Last edited by mpeterson; 11-17-2014 at 11:45 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •