我想查找项目符号列表的实例,以替换为 html 标记列表。请参阅下面的示例:
my_doc.docx ...
text,text,text
My bullet list:
• List point one
• List point two
Some more text here.
...
查找和替换导致
...
text,text,text
My bullet list:
<ul>
<li>List point one</li>
<li>List point two</li>
</ul>
Some more text here.
...
我试过find and replace
子弹字符;不起作用,因为它正在格式化。还尝试find and replace
了具有“列表项目符号”样式的行以及我能找到的任何其他列表样式;不起作用,(可能是因为我使用的 Word for Mac 看起来有问题)
编辑:我有以下 VBScript 可以在我的文档中找到具有项目符号样式的行。我现在需要这个脚本来重写它找到的最后带有 <li> 标记的行。
Sub FindBullet()
Dim oPara As Word.Paragraph
Dim count As Integer
count = 0
Selection.WholeStory
With Selection
For Each oPara In .Paragraphs
If oPara.Range.ListFormat.ListType = _
WdListType.wdListBullet Then
count = count + 1
# from here down it gets shaky!!!
With ActiveDocument.Range.Find
.Text = #How do i convert the oPara to a string here?!?
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.ClearFormatting
With .replacement
.ClearFormatting
.Text = # how do i specify this is where i want the "<li>" & oPara & "</li>"
End With
.Execute Replace:=wdReplaceAll
End If
Next
End With
'Gives you the count of bullets in a document
MsgBox count & " replacements"
End Sub