在 Word 或 Libre Writer 中,有没有办法找到不包含加粗字符的段落?我想删除它们。我可以进入高级查找并选择Wildcard
以及Not bold
,但我不知道如何告诉它只选择段落。
答案1
我不使用 LibreWriter。在 Word 中,我会使用如下宏。
Sub BoldRequired()
' Charles Kenyon 20 September 2020
' remove all paragraphs that have no bold characters
Dim oParagraph As Paragraph
Dim oDocument As Document
Dim rngParagraph As Range
Dim iCount As Double
Set oDocument = ActiveDocument
For Each oParagraph In oDocument.Paragraphs
Set rngParagraph = oParagraph.Range
With rngParagraph.Find
.Text = ""
.ClearFormatting
.Font.Bold = True
.Execute
If .Found = False Then Let rngParagraph.Text = ""
.ClearFormatting
End With
Next oParagraph
Set oDocument = Nothing
Set oParagraph = Nothing
set rngParagraph = Nothing
End Sub