Word中用VB进行文本解析
使用word 2007,我需要解析文档中的文本。
文本格式为:
<number>. <question_text>
a. <answer1_text>
b. <answer2_text>
c. <answer3_text>
d. <answer4_text>
e. <answer5_text>
Answer: <correct_letter>. <feedback_text>
需要以这种形式输出:
<number>) <question_text>
~Y. <feedback_text>
a. <answer1_text>
b. <answer2_text>
*c. <answer3_text>
d. <answer4_text>
e. <answer5_text>
答案 who's letter is the Correct_letter 前面需要有一个 *。
给定文档中有多个问题。任何对 VB 解决方案的帮助将不胜感激。我认为解决方案涉及循环遍历文档中的每一行,查找每个变量,找到所有变量后,以正确的格式输出它们。
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 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来就像使用 Word 作为数据库......这不是我的技能。
但我知道 Word 现在可以使用 XML —— 如果您将其转换为 XML,那么它至少是可查询的...从那里您可以使用 XSL 转换。
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.