4
我想查找項目符號列表的實例,以用html標記的列表替換。請參閱下面的例子:查找並替換爲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的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
是的,這工作得很好。謝謝! – Norto23