如何给WPS每个段落前面添加【段落号X】,段里再加行号[LINE=N]
Dim 段落开始位置 As Long
For Each para In doc.Paragraphs
With 段落Rng.Find
.ClearFormatting
.Text = Chr(13) 'vbCrLf ' 或者 Chr(13) & Chr(10),取决于你的系统和 Word 设置
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindStop ' wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
' 循环查找段落中的每个换行符
Do While .Execute(Forward:=True) = True
' 在每个换行符之前插入行号
' 打印匹配项在段落中的起始位置
'para.Range.Paragraphs.First.Range.Information(wdFirstCharacterLineNumber)
Debug.Print "x=" & para.Range.start & "," & 段落Rng.start