我的常规方法是:
1.查找:[一二三四五六七八九十百]{1,3}*^13 替换为:标题1样式 1.1.查找:[1-5].*^13 替换为:标题2样式 2.定位到开头,插入分节符,“一、”所在的节,插入、页码、格式、起始页码“1”。 3.插入、引用、索引和目录,目录、显示级别:2 PS:感觉正统的保险做法第一步是先查找:^13[一二三四五六七八九十百]{1,3}*^13,再勾选突出所有在该范围找到的项目,查找全部,再点一下标题栏,再在勾选突出所有在该范围找到的项目下找到所选范围,再改查找条件为:[一二三四五六七八九十百]{1,3}*^13。 因为,如果正文也有“一二三四五六七八九十百”的话,上面的第一步会出错。但鉴于老大的原文没有这个,所以。。。
VBA做法是: Sub Example2() Dim astring As String Dim a%, b%, c%, d%, e% Const bstring = "那只敏捷的狐狸越过那只棕毛懒狗" Dim atime As Long atime = Timer For b = 0 To 9 For a = 0 To 9 c = c + 1 astring = astring & chinanumber(b, a) & "、" & bstring & c & "。" & Chr(13) VBA.Randomize d = Int(VBA.Rnd() * 5) + 1 For e = 1 To d astring = astring & e & "." & bstring & "。" & Chr(13) astring = astring & bstring & "。" & Chr(13) Next Next Next Selection.Text = astring MsgBox Timer - atime End Sub Function chinanumber(b, a) As String Dim cstring As String Dim dstring As String cstring = Choose(a + 1, "一", "二", "三", "四", "五", "六", "七", "八", "九", "十") If b <> 0 Then dstring = Choose(b, "", "二", "三", "四", "五", "六", "七", "八", "九") If cstring = "十" Then dstring = Choose(b + 1, "", "二", "三", "四", "五", "六", "七", "八", "九", "十") chinanumber = dstring & cstring Else chinanumber = dstring & "十" & cstring End If Else chinanumber = cstring End If If chinanumber = "十十" Then chinanumber = "一百" End If End Function |