Dim bContinue As Boolean a4n5i.;
NOmFQ)/ &
Dim regEX As New RegExp "}vxHN#
Dim paraCounter As Long '全局段落计数,仅在主程序中可读写,其它过程函数应为只读 "U/yq
#v; :K8
Dim LastTitle0String As String, LastTitle0No As Long |
{Q}:_/q
Dim LastTitle1String As String, LastTitle1No As Long iJ`zWpj+{Q
Dim LastTitle2String As String, LastTitle2No As Long Gk
xtGe
Dim LastTitle3String As String, LastTitle3No As Long "RTv[n!
Dim LastTitle4String As String, LastTitle4No As Long gC(@]%
Dim LastTitle5String As String, LastTitle5No As Long 45k.U $<|
Dim LastTabelString As String, LastTableNo As Long W ",yq|
Dim LastFigureString As String, LastFigureNo As Long U
F$O@l
Yv.7-DHNl
Dim strSeperator As String -]t>'Q?
7AlL,&+
Sub ConvertWidth(fTEXT As String, rText As String) a(kY,<}
Selection.Find.ClearFormatting Hb/8X
!=
Selection.Find.Replacement.ClearFormatting EQ.K+d*K][
Selection.Find.Wrap = wdFindContinue Rg^ps
Me.txtStatus.Text = "转换全角数字字母" & fTEXT & "形式为半角" & rText a$\Bt_
DoEvents my0iE:
Selection.Find.Execute findtext:=fTEXT, replacewith:=rText, Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindContinue, MatchCase:=True R90#T6^
End Sub nok-![
4'TssRot@h
Sub ClearDomain() U>sEFzBup
With Selection.Find 9h/Hy aN
.ClearFormatting I4KE@H"%7
.Replacement.ClearFormatting |h&Z.
.Wrap = wdFindContinue H>o \C
Me.txtStatus.Text = "清除所有域代码" !#zO%
DoEvents O`5h jq#
.Execute findtext:="^d", replacewith:="", Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindContinue, MatchWildcards:=False `"o{MaFA
End With X]o"4#CQIX
End Sub /P Tq.
yy+:x/(N[
Private Sub cmdCheck_Click() BwrX.!M
bContinue = True t)= dKC
Dim NoSeries1(1 To 16) As String o=6 <?v7
Dim NoSeries2(1 To 16) As String \_YDSmjy
Dim NoSeries5(1 To 16) As String ?L0 |$#Iw
Dim NoSeriesRM(1 To 16) As String ^$X|Lq
Dim paraTotal As Long, ParaText As String ksTK'7*
Dim ttString As String, ttNo As String B*t1Y<>x
lF
t^dl^
Dim ShapeCounter As Long, ShapeHeight As Long, ShapeWidth As Long HYL['B?Wid
4;Vi@(G)
Me.txtStatus.Visible = True U1(cBY
Me.lbParaType.Visible = True SSq4KFO1
Me.cmdCheck.Enabled = False GG"6O_
[b_qC'K[
@1xIph<z
GS7'pTsYH
`F]
Dim ParaType As String, rText As String !^o{}*]Pi
}1%%`
Selection.WholeStory nSRNd
A
Selection.NoProofing = True YrYmPSb=
3.1%L"r[)
tm1 = Now `sDLxgwI
3 NFo=Z8
ActiveWindow.View.Type = wdNormalView RB6Q>3g
U#&+n-n
pO
NoSeries1(1) = "一" iXq*EZb"R
NoSeries1(2) = "二" _90<*{bt.
NoSeries1(3) = "三" s4QCun~m
NoSeries1(4) = "四" %'X~9Pvi
NoSeries1(5) = "五" Lz!JLiMEET
NoSeries1(6) = "六" {pA&Q{ ^
NoSeries1(7) = "七" Ud7
Z7?Ym
NoSeries1(8) = "八" ioEjbqD<
NoSeries1(9) = "九" 3@:O1i
NoSeries1(10) = "十" ]s!id[j
NoSeries1(11) = "十一" q!W=U8`
NoSeries1(12) = "十二" )+DDIq
NoSeries1(13) = "十三" 7&D)+{g
NoSeries1(14) = "十四" ?z2! ?
NoSeries1(15) = "十五" X%iJPJLza
NoSeries1(16) = "十六" ?rA3<j
7t1as.
NoSeries2(1) = "㈠" JPHM+3v
NoSeries2(2) = "㈡" i"xV=.
NoSeries2(3) = "㈢" {> <1K6t
NoSeries2(4) = "㈣" #kh:GAp]
NoSeries2(5) = "㈤" V]GF53D
NoSeries2(6) = "㈥" D/JSIDd
NoSeries2(7) = "㈦" t\}_WygN
NoSeries2(8) = "㈧" )8oN$20
NoSeries2(9) = "㈨" S^;;\0#NK
NoSeries2(10) = "㈩" C"$~w3A k
G&@d
J &B
NoSeries5(1) = "①" vCNq2l^CW
NoSeries5(1) = "②" JU.!<
NoSeries5(3) = "③" I ~^Xw7
NoSeries5(4) = "④" ^d@2Y0hH
NoSeries5(5) = "⑤" xcn~KF8
NoSeries5(6) = "⑥" !v(^wqna\
NoSeries5(7) = "⑦" >rJ**y
NoSeries5(8) = "⑧" |>[qC O
NoSeries5(9) = "⑨" 00{a}@n
NoSeries5(10) = "⑩" #C~ </R%
H%etYpD
Pouo# 5
NoSeriesRM(1) = "I" X6T[+]Gc
NoSeriesRM(2) = "II" 9X,iQ
NoSeriesRM(3) = "III" `SOQPAnK+;
NoSeriesRM(4) = "IV" h"/'H)G7_&
NoSeriesRM(5) = "V" ?@7!D8$9
NoSeriesRM(6) = "VI" ^*.+4iHx
NoSeriesRM(7) = "VII" _RbM'_y+E
NoSeriesRM(8) = "VIII" tTF<DD}8
NoSeriesRM(9) = "IX" IC (:RtJ
NoSeriesRM(10) = "X" J@"UFL'^
NoSeriesRM(11) = "XI" `<g6^ P
NoSeriesRM(12) = "XII" z&B9
Yu4M7
NoSeriesRM(13) = "XIII" \I-e{'h
NoSeriesRM(14) = "XIV" {M7`"+~w
NoSeriesRM(15) = "XV" o"FR%%
NoSeriesRM(16) = "XVI" QqRF?%7q"q
D9NQ3[R 9
i = MsgBox("为了你的数据安全,请使用单独保存的文件副本进行本操作。" & vbCrLf & "确定继续进行吗?", vbYesNo) '7/F]S0K
\#WWJh"W
If i = vbNo Then >*
opE I+
Exit Sub em5~4;&'
End If ;]b4O4C\
Dy>6L79G
If Me.chkSuper.Value Then tW94\3)1
Me.txtStatus.Text = "检查修改所有的上标格式" 5!cp^[rGL
c~O
Lr
CheckSuperScript >3pT).wH|M
@}:E{J#g
End If M@P%k`6C
RwYFBc
If Me.chkStyle.Value Then :WX
OD
Me.txtStatus.Text = "设置样式,请稍候...." ^y qRa&
DoEvents &3;"$P
CeateOrModifyStyle /zb/am1#
End If 1KbZ6Msy
YM6
J:89
^)I}#
/}J_2
ClearDomain )QRT/, ;c
TET=>6
@x
!,iT
|Olz h63k:
If Me.chkLIST.Value Then 2K{'F1"RM
Me.txtStatus.Text = "将所有自动列表标题转化为人工标题形式"
nlI3|5
1G.?Y3DC<
ConvertListToOrdinary /CMgWGI
End If \HkBp&bqK
K*{RGE
7(uz*~Z?`0
Dim pType As String, trimpTEXT As String [z ]P5
If Me.chkNum.Value = True Then rsLkH
&aM
Me.txtStatus.Text = "转换全角数字形式为半角"
U#]
J5'i
ConvertWidth "1", "1" ,msP(*qoI
DoEvents # AC
T&J
ConvertWidth "2", "2" Wh)
DoEvents U\B
9Ab
ConvertWidth "3", "3" e^3D`GA
DoEvents ]1XtV<
ConvertWidth "4", "4" ~[dL:=?c
DoEvents <#4""FO*
ConvertWidth "5", "5" 0nL
#-`S
DoEvents 4L ]4WVc
ConvertWidth "6", "6" 8)=(eI$
DoEvents aL*MC gb'
ConvertWidth "7", "7" pgiZA?r*<
DoEvents |JF,n~n
ConvertWidth "8", "8" @eeI4Jz
DoEvents Y]KHCY
ConvertWidth "9", "9" /9&!u )+
DoEvents >
Xh=P%
ConvertWidth "0", "0" J(@" 7RX
DoEvents ZSwuEX
ConvertWidth "a", "a" WW{_D
DoEvents =}kISh
ConvertWidth "b", "b" A%?c1`ZxF
DoEvents dKCl#~LAI'
ConvertWidth "c", "c" U;4i&=.!
DoEvents ?upd
ConvertWidth "d", "d" %8|lAMTY7/
DoEvents Y0krFhL'x0
ConvertWidth "e", "e" t&EizH$
DoEvents VFx[{Hy
ConvertWidth "f", "f" {:*G/*1[.
DoEvents f<i
K%
ConvertWidth "g", "g" CHZ/@g
c
DoEvents U5TkgHN{y
ConvertWidth "h", "h" TWGn:mi
DoEvents ygj%VG
ConvertWidth "i", "i" wpt$bqs|1
DoEvents c0o Z7)*}
ConvertWidth "j", "j" @&`^#pok
DoEvents VevG 64o
ConvertWidth "k", "k" R9 Ab.t
DoEvents yj#FO'UY
ConvertWidth "l", "l" gd]S;<J
h
DoEvents \8!CKnfs
ConvertWidth "m", "m" yo->
mD
DoEvents o$l8"Uv
ConvertWidth "n", "n" R]e&JoY
ConvertWidth "o", "o" DbLo{mFEIj
ConvertWidth "p", "p" y6tqemz
ConvertWidth "q", "q" - _8-
i1?
ConvertWidth "r", "r" J`)/\9'&&
ConvertWidth "s", "s" UPr&
`kaJ
ConvertWidth "t", "t" q~
ZUtF
ConvertWidth "u", "u" =}Zl
E
ConvertWidth "v", "v" &9)/"
ConvertWidth "w", "w" ?d%{-
ConvertWidth "x", "x" i%.k{MY
ConvertWidth "y", "y" YTZ :D/
ConvertWidth "z", "z" _u^3uzu
ConvertWidth "A", "A" u"(NN9s
ConvertWidth "B", "B" D
(8Z90
ConvertWidth "C", "C" EyVu-4L:#
ConvertWidth "D", "D" Hv/5)
ConvertWidth "E", "E" {<@ud0A:\
ConvertWidth "F", "F" kP+,x H)1
ConvertWidth "G", "G" >
^zNKgSQ
ConvertWidth "H", "H" W_E^+Wl@
ConvertWidth "I", "I" fdX|t"oz
ConvertWidth "J", "J" Khi;2{`
ConvertWidth "K", "K" $Wj{B@k
ConvertWidth "L", "L" h U-FSdR
ConvertWidth "M", "M" 5,##p"O(
ConvertWidth "N", "N" 3N-
'{c6]U
ConvertWidth "O", "O" =pi,]m
ConvertWidth "P", "P" q4w]9b/
ConvertWidth "Q", "Q" )Sb-e(sl
ConvertWidth "R", "R" MD;Z UAX<
ConvertWidth "S", "S" Z!~_#_Ugl
ConvertWidth "T", "T" l
+>Y
ConvertWidth "U", "U" XPqGv=CN
ConvertWidth "V", "V" ^h2+""
ConvertWidth "W", "W" {l!{b1KJ
ConvertWidth "X", "X" VgIk '.
ConvertWidth "Y", "Y" ,7bhUE/VB
ConvertWidth "Z", "Z" VBPtM{g
ConvertWidth "^l", "^p" }|2A6^FH.
ConvertWidth "(", "(" ,cS#
ConvertWidth ")", ")" ]r3/hDRDL@
COu5Tu^
End If }xt^}:D
|v8hg])I+
With ActiveDocument )1B?<4
Dim tbl As Table C]8w[)d[`;
For Each tbl In .Tables K mH))LIv
tbl.Rows.Alignment = wdAlignRowCenter _b&26!gl
tbl.Range.Font.NameFarEast = "楷体" E56
tbl.Range.Font.NameAscii = "Times New Roman" *cCx]C.~
tbl.Range.Font.Size = 10.5 (}6\_k[}m
Next %q3`k#?<
Set tbl = Nothing &U?4e'N)T
End With _q#pEv
B !,&{[D
@@U
With ActiveDocument dWiNe!oY2
XP
o#qT8n
For i = 1 To .TablesOfContents.Count ZCj1Cz]"l<
.TablesOfContents(i).Delete hBnUpYec
Next d]E={}qo&
\By_mw
]?H12xz
YR0AI l:L
paraTotal = .Paragraphs.Count tt2
S.j
paraCounter = 1 ^*`#+*C
\ui'~n_t]
LastTitle0No = 0 X"d"a={]
LastTitle1No = 0
l$\B>u,>
LastTitle2No = 0 RHn3\N
LastTitle3No = 0 m4oj1h_4
LastTitle4No = 0 J-'XT_k:iM
LastTableNo = 0
-*KKrte
LastFigureNo = 0 y[85eM
Q"u2<
Dim Sec As Long qMVuFwPhi
B-w`mcqp$
Sec = InputBox("正文从第一节开始?", "节设置", 6) 7r'_p$
If Sec = 0 Then h[iO'Vq
Exit Sub '_4apyq|
End If r
u2M"]T
g$#A'Du
k = 0 ~mt{j7
Do While (paraCounter < paraTotal) And bContinue ]58~b%s
k = k + 1 (>A#|N1U
If .Paragraphs(paraCounter).Range.Information(wdActiveEndSectionNumber) >= Sec Then Vf~-v$YI
Exit Do aY?VP?BL
End If "Zhh>cz
paraCounter = paraCounter + 1 \3^V-/SJf
If k Mod 20 = 0 Then c}n66qJF5
Me.lbCounter.Caption = paraCounter h M7 SGEV
DoEvents +@!\3a4!
End If
4hxP`!<
Loop ;f[##=tm
)'f=!'X
P HOngn
Do While (paraCounter < paraTotal) And bContinue ejyx[CF
y*X.DS 1(w
ParaText = Trim(.Paragraphs(paraCounter).Range.Text) Hy\q{
ShapeHeight = 0 I*Dj@f`
ShapeWidth = 0 (nq""kO6'
*9r(lmrfj
CheckPara .Paragraphs(paraCounter).Range, ParaType, rText, ttString, ttNo, ShapeCounter, ShapeHeight, ShapeWidth 8CRbo24"s
Uv>e :U7 ;
Select Case ParaType }"WovU{*s
Case "【】表格内容" us?q^>u
.Paragraphs(paraCounter).Style = "QLNU表格内容" %.f%Q?P
Case "章" Zl&ED{k<
LastTitle0No = LastTitle0No + 1 Z]Udx
'新一章开始,复位其下属标题编号 zn^7#$fC
LastTitle1No = 0 8%u|[Si;
LastTitle2No = 0 lMu9Dp
LastTitle3No = 0 0]*W0#{Zj
LastTitle4No = 0 ysK J=
$8U$.~v
k = Val(ttNo) b3[[ Ah-
If k = 0 Then '非数字编号章节 4(P<'FK $
If ttNo <> NoSeries1(LastTitle0No) Then eL"'-
d+]
rText = "第" & NoSeries1(LastTitle0No) & ttString HAI)+J
Me.ErrMsg.AddItem "章节编号错误:" & ParaText n:wAxU
End If WO9vOS>
Else Gr&e]M[ l
If Val(ttNo) <> LastTitle0No Then AN:s%w2
rText = "第" & LastTitle0No & ttString z(Uz<*h8
Me.ErrMsg.AddItem "章节编号错误:" & ParaText lJ= EP.T
End If &x\)] i2f
:3R3>o6m
End If =>c0NT
qGV(p}$O
'章段落设置 0lniu=xmQ-
'字体大小:三号16磅小三号15磅四号14磅小四号12磅五号10.5磅小五号9磅 `3ha~+Goo!
.Paragraphs(paraCounter).Style = "QLNU章节" ]5QXiF8`
.Paragraphs(paraCounter).Range.Select U4-RI]Cpf
Selection.EndKey unit:=wdLine d9S?dx
tc = Replace(rText, vbCr, "") `lOW7Z}
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="TC """ & tc & """ \l 1 ", PreserveFormatting:=False M0lJyzJ
Case "一级标题" $mKExW
LastTitle1No = LastTitle1No + 1 u(8{5"C
'新一级标题开始,复位其下属标题编号 k6z
]-XG
LastTitle2No = 0 K<::M3eQ
LastTitle3No = 0 OqMdm~4B!j
LastTitle4No = 0 k"gm;,`
*q=\e 9
If ttNo <> NoSeries1(LastTitle1No) Then
hy;V~J#
rText = NoSeries1(LastTitle1No) & "、" & ttString /v<Gt%3X
Me.ErrMsg.AddItem "一级标题编号错误:" & ParaText iR9duP+
End If h>*3i#
4Ol1
T(J#
ob/<;SrU<
'一级标题段落设置 格式:一、标题内容 Ru#pJb(R
.Paragraphs(paraCounter).Range.Text = rText 6c(b*o
.Paragraphs(paraCounter).Style = "QLNU一级标题" FIfLDT+ Wh
.Paragraphs(paraCounter).Range.Select Q.eD:@%iE
Selection.EndKey unit:=wdLine D:j5/ *
tc = Replace(rText, vbCr, "") f?=0Wzb
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="TC """ & tc & """ \l 1 ", PreserveFormatting:=False V6d,}Z+"z'
Case "二级标题" A9@coP5
LastTitle2No = LastTitle2No + 1 zj2y=A|Y
'新二级标题开始,复位其下属标题编号 6
l
2O>V
LastTitle3No = 0 PPV T2;9
LastTitle4No = 0 %pOxt<
Wd!Z`,R
If ttNo <> NoSeries1(LastTitle2No) Then RAu(FJ
rText = "(" & NoSeries1(LastTitle2No) & ")" & ttString s 7wA3|9
ErrMsg.AddItem "二级标题编号错误:" & ParaText *a\x!c"
End If rp<~=X
9]ZfSn)
'二级标题段落设置 格式:(一)、标题内容 eP:\\;
;
.Paragraphs(paraCounter).Range.Text = rText J5jI/P
.Paragraphs(paraCounter).Style = "QLNU二级标题" LNR1YC1c
$Bc3| `K1v
.Paragraphs(paraCounter).Range.Select w/ZP.B
Selection.EndKey unit:=wdLine `a[fC9
tc = Replace(rText, vbCr, "") b|k^
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="TC """ & tc & """ \l 2 ", PreserveFormatting:=False YKU|D32
"2-D[rYZ
Case "三级标题" r
^*D8
LastTitle3No = LastTitle3No + 1 X=f %!
'新三级标题开始,复位其下属标题编号 {g[kn^|
LastTitle4No = 0 :oW 16m1`
QR( ;a:
If Val(ttNo) <> LastTitle3No Then 1>\V>g9
rText = LastTitle3No & ". " & ttString f,6V#,
Me.ErrMsg.AddItem "三级标题编号错误:" & ParaText h {
J io>
H)Me!^@[D
End If E>-I
|X"L1
'三级标题段落设置 格式:1. 标题内容 C:sgT6
.Paragraphs(paraCounter).Range.Text = rText p ]jLs|tat
.Paragraphs(paraCounter).Style = "QLNU三级标题" N.Q}.(N0
.Paragraphs(paraCounter).Range.Select G?LC!9MB
Selection.EndKey unit:=wdLine K/Y"oQ2
tc = Replace(rText, vbCr, "") NQuqM`LSQ
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="TC """ & tc & """ \l 3 ", PreserveFormatting:=False A =Z$H2
Case "四级标题"
5c}loOq
LastTitle4No = LastTitle4No + 1 0S>L0qp
}BT0dKx
If Val(ttNo) <> LastTitle4No Then wsQuJrG
rText = "(" & LastTitle4No & "). " & ttString f$5pp=s: n
ErrMsg.AddItem "四级标题编号错误:" & ParaText gzvgXZ1q"
pN9U1!|uam
End If Tr}XG
'四级标题段落设置 格式:(1). 标题内容 &+k*+
.Paragraphs(paraCounter).Range.Text = rText m*B4a9f
.Paragraphs(paraCounter).Style = "QLNU四级标题" jHE^d<=O^
.Paragraphs(paraCounter).Range.Select EQpF:@_
Selection.EndKey unit:=wdLine AZik:C"Q
tc = Replace(rText, vbCr, "") x<rS2d-Y
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="TC """ & tc & """ \l 4 ", PreserveFormatting:=False [+W<;iep
;<T,W[3J
Case "表格标题" Yc6.v8a
LastTableNo = LastTableNo + 1 icIWv
C .B=E"e
If ttNo <> CStr(LastTableNo) Then f>Ua 7!b
rText = "表" & LastTableNo & ". " & ttString ; }T+ImjA
ErrMsg.AddItem "表格编号错误:" & ParaText {0+WVZ4u
y<nPZ<