需要在RTF字段/返回包含特定字符串的行中搜索每一行 [英] Need to search each line in RTF field / return lines that contain specific string

查看:98
本文介绍了需要在RTF字段/返回包含特定字符串的行中搜索每一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,尊敬的专家!


我有一个名为TxtMedications的RTF字段它包含多行文本,其中每一行显然都以< div>开头。标签。例如:


Lacosamide 200 mg bid

Divalproex ER 1500 mg qhs

普瑞巴林50 mg q8h

布洛芬400毫克tid PRN

西替利嗪每日10毫克PRN


或以字符串形式...


< div>拉科酰胺200 mg bid< / div>

< div> Divalproex ER 1500 mg qhs< / div>

< div>普瑞巴林50 mg q8h< ; / div>

< div>布洛芬400毫克tid PRN< / div>

< div>西替利嗪每日10毫克PRN< / div>


我正在尝试做什么(以及我目前所处的位置)将所有包含字符串PRN的行分开。到另一个RTF文本框,称为TxtPRNMeds并将其余部分放入名为TxtScheduledMeds的RTF文本框中。


我能够使用InStr()和Mid()函数返回标签之间的第一个文本字符串,并搜索该字符串中的PRN。 />

展开 | 选择 | Wrap | 行号

解决方案

亲爱的,


我理解正确,你有一个备注表格格式为RTF的备注字段(长文本)?此外,< div>在哪里?来自的标签,是从外部来源导入的吗?


你好吗...


有几种方法可以解决这个问题。从未在桌面或字段级别使用过RTF,我不得不自学HTML标签。


我快速模拟了你的表格和表格,在我看来最好的(最简单的方法)去做这个就是使用Split()函数来填充和数组来保存数据:

展开 | 选择 | Wrap | 行号

这是一种聪明的方式,听起来它也是最有效的方式。为了澄清你之前的帖子,我有一个以富文本格式化的备忘录字段,需要分成两个用富文本格式化的文本框(TxtScheduledMeds和TxtPRNMeds)。为了测试和诸如此类,我正在使用一个富文本文本框,我正在调用TxtMedications,它包含需要拆分的字符串。


我已经实现了你的技术并试图循环遍历数组元素以找到匹配的字符串。

展开 | 选择 | Wrap | 行号


Hello, esteemed experts!

I have a RTF field called "TxtMedications" that contains multiple lines of text, each of these obviously preceded by a <div> tag. For example:

Lacosamide 200 mg bid
Divalproex ER 1500 mg qhs
Pregabalin 50 mg q8h
Ibuprofen 400 mg tid PRN
Cetirizine 10 mg daily PRN

Or in string form...

<div>Lacosamide 200 mg bid</div>
<div>Divalproex ER 1500 mg qhs</div>
<div>Pregabalin 50 mg q8h</div>
<div>Ibuprofen 400 mg tid PRN</div>
<div>Cetirizine 10 mg daily PRN</div>

What I''m trying to do (and where I''m currently stuck) is separating out all lines which contain the string "PRN" into another RTF text box, called "TxtPRNMeds" and having the remainder put into a RTF text box called "TxtScheduledMeds".

I''m able to use the InStr() and Mid() functions to return the first string of text between the tags and search that string for "PRN".

Expand|Select|Wrap|Line Numbers

解决方案

Dear Perplexed,

Just so I understand correctly, you have a Memo field (Long Text) that is formatted as RTF on the bound form? Also, where are the <div> tags coming from, are they imported from an external source?


Hi Perplexed...

A couple of ways to tackle this. Having never used RTF on a table or field level, I had to educate myself on the HTML tags.

I did a quick mock-up of your form and table and in my opinion the best (easiest way) to go about this would be to use the Split() function to populate and array to hold the data:

Expand|Select|Wrap|Line Numbers


That''s a clever way of doing it, and sounds like it''d be the most efficient way too. For clarification on your earlier post, I have a memo field formatted in rich text that needs to be split into two textboxes formatted with rich text (TxtScheduledMeds and TxtPRNMeds). For testing and whatnot, I''m using a rich text textbox, that I''m calling TxtMedications, which holds the string needing to be split.

I''ve implemented your technique and tried to loop through the array elements to find matching string.

Expand|Select|Wrap|Line Numbers


这篇关于需要在RTF字段/返回包含特定字符串的行中搜索每一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆