开发者

Text parsing with VB in Word

开发者 https://www.devze.com 2023-03-21 17:57 出处:网络
Using word 2007, I need to parse text in a document. The text is in the form: <number>. <question_text>

Using word 2007, I need to parse text in a document.

The text is in the form:

<number>. <question_text>
a. <answer1_text>
b. <answer2_text>
c. <answer3_text>
d. <answer4_text>
e. <answer5_text>
Answer: <correct_letter>. <feedback_text>

It needs to be outputted in this form:

<number>) <question_text>
~Y. <feedback_text>
a. <answer1_text>
b. <answer2_text>
*c. <answer3_text>
d. <answer4_text>
e. <answer5_text>

The answer who's letter is开发者_Python百科 the correct_letter needs to have a * in front of it.

There are multiple questions in a given document. Any help towards a VB solution will be appreciated. I figure the solution involves looping through each line in the document, looking for each variable, and once all variables are found, output them in the correct formatting.


It sounds like using Word as your database...which is not my skillset.

But I know Word works with XML now -- if you converted it to XML, it would then at least be queryable... From there you could use XSL Transformations.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号