Dim bContinue As Boolean 'm O2t~n
c3k|G<C2
Dim regEX As New RegExp HarFE4V
Dim paraCounter As Long '全局段落计数,仅在主程序中可读写,其它过程函数应为只读 mP-2s;q
T~s}N x#
Dim LastTitle0String As String, LastTitle0No As Long U:|H9+5
Dim LastTitle1String As String, LastTitle1No As Long <xn;bp[
Dim LastTitle2String As String, LastTitle2No As Long FT/amCRyT
Dim LastTitle3String As String, LastTitle3No As Long BXhWTGiG
Dim LastTitle4String As String, LastTitle4No As Long |(ocD
md
Dim LastTitle5String As String, LastTitle5No As Long U8O(;+
Dim LastTabelString As String, LastTableNo As Long n+oD
C65[
Dim LastFigureString As String, LastFigureNo As Long A}G|Yfn
1S%}xs
R0
Dim strSeperator As String (
v@jc8
y
Q)^g3J
Sub ConvertWidth(fTEXT As String, rText As String) GDPo`#~
Selection.Find.ClearFormatting n
)K6i7]xk
Selection.Find.Replacement.ClearFormatting x~/+RF XF
Selection.Find.Wrap = wdFindContinue SLoo:)
Me.txtStatus.Text = "转换全角数字字母" & fTEXT & "形式为半角" & rText B*@6xS[IL
DoEvents f0oek{
Selection.Find.Execute findtext:=fTEXT, replacewith:=rText, Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindContinue, MatchCase:=True |Td5l?
End Sub V8"Wpl9Cz
inF6M8
A1
Sub ClearDomain() g-@h>$<
1
With Selection.Find O3%[dR
.ClearFormatting J_ J+cRwq
.Replacement.ClearFormatting daX*}Ix
.Wrap = wdFindContinue k/lFRi-i
Me.txtStatus.Text = "清除所有域代码" - DL"-%X.
DoEvents cwynd=^nC
.Execute findtext:="^d", replacewith:="", Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindContinue, MatchWildcards:=False np6HUH
End With Q2\
End Sub k^%_V|&W/(
sR*Nq5F#9
Private Sub cmdCheck_Click() G;]:$J
bContinue = True l4ouZR
Dim NoSeries1(1 To 16) As String Y\?j0X;
Dim NoSeries2(1 To 16) As String )|]Z>>%t
Dim NoSeries5(1 To 16) As String ax@H"d&
Dim NoSeriesRM(1 To 16) As String @E_zR
Dim paraTotal As Long, ParaText As String
(ZPXdr
Dim ttString As String, ttNo As String nb+m.X
mU G
%LM
Dim ShapeCounter As Long, ShapeHeight As Long, ShapeWidth As Long Z$;"8XUM
~7SH4Cr
Me.txtStatus.Visible = True 7GZq|M_:y
Me.lbParaType.Visible = True ^?"^Pmw
Me.cmdCheck.Enabled = False _!AJiP3!)4
z{?4*Bq
r4;Bu<PQN1
W9R`A
T:!MBWYe |
Dim ParaType As String, rText As String 0"4@;e_)>
Sz0+<F#5
Selection.WholeStory QnKC#
Selection.NoProofing = True ;NsO
EOVZGZF
tm1 = Now BUC,M:J+H
cZQu *K^j
ActiveWindow.View.Type = wdNormalView @]'SeiNp
C6@t
NoSeries1(1) = "一" m0( E kK
NoSeries1(2) = "二" +?d} 7zh
NoSeries1(3) = "三" LSkk;)'2K
NoSeries1(4) = "四"
6/2v
NoSeries1(5) = "五" o&-L0]i|
NoSeries1(6) = "六" km\%BD~
NoSeries1(7) = "七" dZ2`{@AYY
NoSeries1(8) = "八" 77Q}=80GU;
NoSeries1(9) = "九" G6O/(8
NoSeries1(10) = "十" Oif,|:
NoSeries1(11) = "十一" \G;CQV#{9
NoSeries1(12) = "十二" MF.[8Zb
NoSeries1(13) = "十三" fLB1)kTS
NoSeries1(14) = "十四" AcC8)xRpk4
NoSeries1(15) = "十五" _CdROo6I
NoSeries1(16) = "十六" d6.}.*7Whc
#`/QOTnm2c
NoSeries2(1) = "㈠" a8s4T$
NoSeries2(2) = "㈡" 9
5 H?{
NoSeries2(3) = "㈢" 3jPB#%F
NoSeries2(4) = "㈣" mG(N:n%*K
NoSeries2(5) = "㈤" Q_4Zb
NoSeries2(6) = "㈥" |}S1o0v{(a
NoSeries2(7) = "㈦" +d39f-[
NoSeries2(8) = "㈧" 8wIK:
NoSeries2(9) = "㈨" ^
KH>1!
NoSeries2(10) = "㈩" 0Nr\2|
agsISu(
NoSeries5(1) = "①" CLK^ gZ
NoSeries5(1) = "②" 5$Kf]
ZP
NoSeries5(3) = "③" _t-7$d"
NoSeries5(4) = "④" e4.&aIC[
NoSeries5(5) = "⑤" _ #'9kx|)
NoSeries5(6) = "⑥" ;$!I&<)
NoSeries5(7) = "⑦" Do;#NLrWb
NoSeries5(8) = "⑧" JTUNb'#RZ
NoSeries5(9) = "⑨" a%K}j\M
NoSeries5(10) = "⑩" y1,5$0@G
xm^95}80yh
QIA R
NoSeriesRM(1) = "I" r!K|E95oj9
NoSeriesRM(2) = "II" C\Ayv)S#2
NoSeriesRM(3) = "III" ULl_\5s2
NoSeriesRM(4) = "IV" Hj~O49%j&
NoSeriesRM(5) = "V" @"8R3BN
NoSeriesRM(6) = "VI" lbkLyp2
NoSeriesRM(7) = "VII" jXR16|
NoSeriesRM(8) = "VIII" y/R+$h(%
NoSeriesRM(9) = "IX" gdi`x|0
NoSeriesRM(10) = "X" /V^sJ($V$~
NoSeriesRM(11) = "XI" - L
~
Uu^o
NoSeriesRM(12) = "XII" e@jfIF0=}
NoSeriesRM(13) = "XIII" }kPVtSQ
NoSeriesRM(14) = "XIV" ;~/4d-
NoSeriesRM(15) = "XV" 'ZnIRE,N
NoSeriesRM(16) = "XVI" }lfn0 %(@
uva\0q
i = MsgBox("为了你的数据安全,请使用单独保存的文件副本进行本操作。" & vbCrLf & "确定继续进行吗?", vbYesNo) -JTG?JOd]
)H+kB<n
If i = vbNo Then dlD}Ub
Exit Sub xzikD,FV
End If -g~~] K%
{;k_!v{
If Me.chkSuper.Value Then \4s;!
R!
Me.txtStatus.Text = "检查修改所有的上标格式" IZ~.{UQ
]Oso#GYD
CheckSuperScript mk= #\>
T[2}p=<%
End If
(@Zcx9
4/MNqit+
If Me.chkStyle.Value Then 4e9E'
"8%
Me.txtStatus.Text = "设置样式,请稍候...." #s+Q{2s
DoEvents YIOR$
CeateOrModifyStyle tWk{1IL
End If 6tdI6
!F7: i
.#!
mDlY;
`K?1L{p'4
ClearDomain =kFuJ
x)f
9X]f
[^
_!:@
w9
V/bH^@,sA
If Me.chkLIST.Value Then D 'L{wm
Me.txtStatus.Text = "将所有自动列表标题转化为人工标题形式" LK+felL
)w"0w(
ConvertListToOrdinary -P#nT 2
End If )iSy@*nY
(=JueF@J
Kbas-</Si
Dim pType As String, trimpTEXT As String &jm[4'$
*z
If Me.chkNum.Value = True Then kaFnw(xa
Me.txtStatus.Text = "转换全角数字形式为半角" =Ahw%`/&}]
ConvertWidth "1", "1" ;|30QUYh
DoEvents IVteF*8hU
ConvertWidth "2", "2" Z[}
$n-V
DoEvents iz`jDa Q|1
ConvertWidth "3", "3" 295w.X(J
DoEvents p>p'.#M
ConvertWidth "4", "4" 'h}7YP, w
DoEvents -,GEv%6c
ConvertWidth "5", "5" OCW+?B;
DoEvents E5{n?e
ConvertWidth "6", "6" B||c(ue
DoEvents SDc"
4g`
ConvertWidth "7", "7" x!?Z*v@I
DoEvents 3*WS"bt
ConvertWidth "8", "8" t!jwY /T
DoEvents
:]c=pH
ConvertWidth "9", "9" O5;-Om
DoEvents x/ I;nMY
ConvertWidth "0", "0" ]kS7n@8
DoEvents Yu3_=:
<C
ConvertWidth "a", "a" pUL sGb
DoEvents `d
*b]2
ConvertWidth "b", "b" <SQ(~xYi
DoEvents YMu)
ConvertWidth "c", "c" 6V;:+"BkJ
DoEvents btQet.
ConvertWidth "d", "d" },PBqWe
DoEvents j9xXKa5
ConvertWidth "e", "e" PU+1=%'V
DoEvents QymD-A"P
ConvertWidth "f", "f" AZwa4n}"
DoEvents :[?!\m%0
ConvertWidth "g", "g" s.y}U5Ty?P
DoEvents E@pFTvo
ConvertWidth "h", "h" Dl\d_:+
DoEvents FpzP#;
ConvertWidth "i", "i" sqG`"O4W
DoEvents 3!Bj{;A
ConvertWidth "j", "j" EcW1;wH
DoEvents DHzkRCM
ConvertWidth "k", "k" &@; RI~
DoEvents Wk[)+\WQ?
ConvertWidth "l", "l" p&5S|![\
DoEvents _,Q[2gQ5N
ConvertWidth "m", "m" B01^oYM}
DoEvents bp%S62Dj
ConvertWidth "n", "n" 8c).8RL f
ConvertWidth "o", "o" t w!.%_1^
ConvertWidth "p", "p" |<Bpv{]P
ConvertWidth "q", "q" C*G/_`?9
ConvertWidth "r", "r" U;gp)=JNT
ConvertWidth "s", "s" : bv|Ah
ConvertWidth "t", "t" qGa<@ b
ConvertWidth "u", "u" Nza; O[
ConvertWidth "v", "v"
Qa?aL
ConvertWidth "w", "w" FpdHnu i1
ConvertWidth "x", "x" JS7dsO0;
ConvertWidth "y", "y" };p~A-E=
ConvertWidth "z", "z" &<h?''nCy
ConvertWidth "A", "A" *?N<S$m
ConvertWidth "B", "B" ,n5a] )Dg
ConvertWidth "C", "C" ;+%Z@b%
ConvertWidth "D", "D" +*a7GttU
ConvertWidth "E", "E" ^zeL+(@ r/
ConvertWidth "F", "F" {!t=n
ConvertWidth "G", "G" ~:Ixmqi}R
ConvertWidth "H", "H" stXda@y<p
ConvertWidth "I", "I" DMMLzS0A
ConvertWidth "J", "J" #=x+
[d+
ConvertWidth "K", "K" !4B_$6US
ConvertWidth "L", "L" xt))]aH
ConvertWidth "M", "M"
UTX](:TC
ConvertWidth "N", "N" xBWx+
My
ConvertWidth "O", "O" q{@P+2<wF
ConvertWidth "P", "P" s3< F
ConvertWidth "Q", "Q" [q$e6JwAt
ConvertWidth "R", "R" 8.2`~'V
ConvertWidth "S", "S" <[9?Rj@
ConvertWidth "T", "T" g)cY\`&W8
ConvertWidth "U", "U" 1;`Fe":;vC
ConvertWidth "V", "V" Omb.53+
ConvertWidth "W", "W" x@Vt[}e
ConvertWidth "X", "X" %uuH^ A
ConvertWidth "Y", "Y" ;]@exp5
ConvertWidth "Z", "Z" ^0Q'./A{&
ConvertWidth "^l", "^p" 4\1;A`2%0
ConvertWidth "(", "(" ,'_(DJX
ConvertWidth ")", ")" [B,p,Q"
K;C_Z/<%
End If b,Lw7MY}[
G>0)I
With ActiveDocument (H-cDsh;c
Dim tbl As Table A'~#9@l<
For Each tbl In .Tables ue9h
tbl.Rows.Alignment = wdAlignRowCenter *(nJX.7
tbl.Range.Font.NameFarEast = "楷体" C8MWIX}
tbl.Range.Font.NameAscii = "Times New Roman" ^j iE9k)
tbl.Range.Font.Size = 10.5 i[_|%'p
Next
[R\=M'
Set tbl = Nothing !x_t`78T
End With pK"&QPv
h0XH`v
8KKz5\kn7
With ActiveDocument "Q?_ EE n
f9F2U
)
For i = 1 To .TablesOfContents.Count xgs@gw7!n0
.TablesOfContents(i).Delete X<FOn7qf
Next GLcd9|H
DZP*x
h--45`cE
* gHCy4u{
paraTotal = .Paragraphs.Count Y?t2,cm
paraCounter = 1 l/F!Bq[*g
[`9^QEj
LastTitle0No = 0 QQ~23TlA
LastTitle1No = 0 dyl
0]Z
LastTitle2No = 0 ;NG1{]|Z
LastTitle3No = 0 qmID-t"
LastTitle4No = 0 OQc{
V
LastTableNo = 0 mt^`1ekoY
LastFigureNo = 0 J{!'f|
J
N(BiOLZL6
Dim Sec As Long cD8Ea(
9m~t
j_
Sec = InputBox("正文从第一节开始?", "节设置", 6) 6Pijvx^0
If Sec = 0 Then P57GqT
Exit Sub #%WCL'6B
End If u
GIr&`S
g? I!OG
k = 0 mR,O0O}&
Do While (paraCounter < paraTotal) And bContinue +,wWhhvlzv
k = k + 1 sW'6}^Q
If .Paragraphs(paraCounter).Range.Information(wdActiveEndSectionNumber) >= Sec Then U/5$%0)
Exit Do <S{7Ro
End If f?5A"-NS
paraCounter = paraCounter + 1 QQq/5r4O`q
If k Mod 20 = 0 Then e&ts\0
Me.lbCounter.Caption = paraCounter GoL|iNW`
DoEvents 7vq
DZg
End If @E(P9zQ/zy
Loop (GNEYf|
yDuq6
`R*
_<2RYXBC
Do While (paraCounter < paraTotal) And bContinue 7@@<5&mN
"5(W[$f*]v
ParaText = Trim(.Paragraphs(paraCounter).Range.Text) Z+,CL/
ShapeHeight = 0
p2^)2v
ShapeWidth = 0 wo]ks}9
g@(4ujOT
CheckPara .Paragraphs(paraCounter).Range, ParaType, rText, ttString, ttNo, ShapeCounter, ShapeHeight, ShapeWidth $^IjFdD
`fMpV8vv
Select Case ParaType Qpw@MF2P
Case "【】表格内容" 94YA2_f;
.Paragraphs(paraCounter).Style = "QLNU表格内容" `~h0?g
Case "章" &L'6KEahR
LastTitle0No = LastTitle0No + 1 FH[#yq.Pr
'新一章开始,复位其下属标题编号 !"%S#nrL$
LastTitle1No = 0 _[%n ~6
LastTitle2No = 0 )r pD2H
LastTitle3No = 0 `Jqf**t
LastTitle4No = 0 ?cJA^W
I3An57YV].
k = Val(ttNo) kw#X]`c3
If k = 0 Then '非数字编号章节 l{QC}{Ejc2
If ttNo <> NoSeries1(LastTitle0No) Then [x|)}P7%s
rText = "第" & NoSeries1(LastTitle0No) & ttString :fW.-^"VP
Me.ErrMsg.AddItem "章节编号错误:" & ParaText ,@479ZvvR3
End If *F..ZS'$[
Else u]SZ{[e
If Val(ttNo) <> LastTitle0No Then vgN@~Xa
rText = "第" & LastTitle0No & ttString n5\}KZh
Me.ErrMsg.AddItem "章节编号错误:" & ParaText V:8@)Hc=
End If W
W35&mI)k
J7Sx!PQ
End If kAt
RY4p
}Q
;BQ2[
'章段落设置 J
eL~]F
'字体大小:三号16磅小三号15磅四号14磅小四号12磅五号10.5磅小五号9磅 Q2FQhc@L(:
.Paragraphs(paraCounter).Style = "QLNU章节" =tHD 4I
.Paragraphs(paraCounter).Range.Select -`g J
Selection.EndKey unit:=wdLine |
F8]Xnds
tc = Replace(rText, vbCr, "")
}EP|Mb
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="TC """ & tc & """ \l 1 ", PreserveFormatting:=False 1Df,a#,y"
Case "一级标题" )tCx5 9
LastTitle1No = LastTitle1No + 1 IE}Sdeqi)
'新一级标题开始,复位其下属标题编号 X]MTaD.t
LastTitle2No = 0 @x*.5:[
LastTitle3No = 0
Y=|CPE%V
LastTitle4No = 0 p $XnOh
b(1:w"wD
If ttNo <> NoSeries1(LastTitle1No) Then DEcGFRgN~
rText = NoSeries1(LastTitle1No) & "、" & ttString lm!FM`m
Me.ErrMsg.AddItem "一级标题编号错误:" & ParaText S,VyUe4P4
End If p_;r%o=
<irpmRQr
Zg2]GJP
'一级标题段落设置 格式:一、标题内容 '?b\F~$8
.Paragraphs(paraCounter).Range.Text = rText "H@Fe
.Paragraphs(paraCounter).Style = "QLNU一级标题" K,]woNxaw
.Paragraphs(paraCounter).Range.Select Gj*SPU
Selection.EndKey unit:=wdLine 5DUi4 Cbgy
tc = Replace(rText, vbCr, "") \D ^7Z97
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="TC """ & tc & """ \l 1 ", PreserveFormatting:=False IBDVFA
Case "二级标题" 8,H~4Ce3
LastTitle2No = LastTitle2No + 1 )u-ns5
'新二级标题开始,复位其下属标题编号 zNwc((
LastTitle3No = 0 #'wL\3
LastTitle4No = 0 "5y<G:$+~
t)KPp|&
If ttNo <> NoSeries1(LastTitle2No) Then m$)YYpX
rText = "(" & NoSeries1(LastTitle2No) & ")" & ttString C&e8a9*,(a
ErrMsg.AddItem "二级标题编号错误:" & ParaText 1S&0
End If 8ZFH}v@V1'
>gF-6nPQ
'二级标题段落设置 格式:(一)、标题内容 X4Lsvvz%@
.Paragraphs(paraCounter).Range.Text = rText PH[4y:^DN
.Paragraphs(paraCounter).Style = "QLNU二级标题" *s~i 2}
z41D^}b
.Paragraphs(paraCounter).Range.Select IE|,~M2
Selection.EndKey unit:=wdLine 4':MI|/my_
tc = Replace(rText, vbCr, "") {x|MA(NO
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="TC """ & tc & """ \l 2 ", PreserveFormatting:=False 9V.+U7\w
k}#@8n|b
Case "三级标题" qA04Vc[2
LastTitle3No = LastTitle3No + 1 ^SgN(-QH
'新三级标题开始,复位其下属标题编号 >6w@{p2B
LastTitle4No = 0 d0TgqO{
K('
9l& A
If Val(ttNo) <> LastTitle3No Then i"vDRrDe
rText = LastTitle3No & ". " & ttString X&/(x
Me.ErrMsg.AddItem "三级标题编号错误:" & ParaText y]w )`}Ax
2G H)iUmc
End If #U:0/4
P(
'三级标题段落设置 格式:1. 标题内容 o;E(Kj
.Paragraphs(paraCounter).Range.Text = rText |K6nOX!i
.Paragraphs(paraCounter).Style = "QLNU三级标题" YN$`y1V
.Paragraphs(paraCounter).Range.Select 8pd&3G+
Selection.EndKey unit:=wdLine o16d`}/<
tc = Replace(rText, vbCr, "") X:DMT>5k
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="TC """ & tc & """ \l 3 ", PreserveFormatting:=False *XHj)
DC;
Case "四级标题" KoFv0~8Q
LastTitle4No = LastTitle4No + 1 $@68=
M *v^N]>"G
If Val(ttNo) <> LastTitle4No Then RZ<.\N
(M
rText = "(" & LastTitle4No & "). " & ttString }=TqJy1
ErrMsg.AddItem "四级标题编号错误:" & ParaText BL7>dZOa
=?^-P{:\?
End If mqubXS;J|P
'四级标题段落设置 格式:(1). 标题内容 xS-w\vbLV
.Paragraphs(paraCounter).Range.Text = rText NWeV>;lh9
.Paragraphs(paraCounter).Style = "QLNU四级标题" ]LMiMj
.Paragraphs(paraCounter).Range.Select @PKAz&0
Selection.EndKey unit:=wdLine t&38@p
tc = Replace(rText, vbCr, "") Zi
ma^IL
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="TC """ & tc & """ \l 4 ", PreserveFormatting:=False 1T:)Zv'
80 dSQ"y
Case "表格标题" ]bf'
LastTableNo = LastTableNo + 1 { qjUI
$f9 ,##/
If ttNo <> CStr(LastTableNo) Then xiEcEz'lk
rText = "表" & LastTableNo & ". " & ttString Un]DFu
ErrMsg.AddItem "表格编号错误:" & ParaText nM=2"`@$
&&ja|o-
End If V, E9Uds
*u58l(&`8
'表格名称段落设置 格式:表1. 表格名称 haN"/C^
.Paragraphs(paraCounter).Style = "QLNU表格标题" S io1Q0
xe = Replace(rText, vbCr, "") xNn>+J
.Paragraphs(paraCounter).Range.Select y)0gJP
L^
Selection.MoveEnd wdCharacter, -1 '选择范围包括行尾的换行符。 zI(xSX@
Selection.Range.Text = xe .x]'eq}
Selection.EndKey \
=S3 L<
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="XE " & """" & xe & """", PreserveFormatting:=False ixg\[5.Q+
AwtIWH*e
Case "表格首行" F|9a}(-7
.Paragraphs(paraCounter).Style = "QLNU表格首行" *13g<#$
Case "图片标题" C-_(13S
LastFigureNo = LastFigureNo + 1 x-tm[x@;o
.[#xQ=9`
If ttNo <> CStr(LastFigureNo) Then ShsJ_/C2
rText = "图" & LastFigureNo & ". " & ttString { 576+:*
ErrMsg.AddItem "表格编号错误:" & ParaText YcPKM@xo
,nI_8r"M>
End If 9+W!k^VWq
'图片名称段落设置 格式:图1. 图名称 Tq.MubaO
.Paragraphs(paraCounter).Range.Text = rText $3lt{ %
.Paragraphs(paraCounter).Style = "QLNU图片标题" X #&(~1O
.Paragraphs(paraCounter).Range.Select )gL&
Selection.EndKey unit:=wdLine '
l|41wxk
xe = Replace(rText, vbCr, "") m9 ^m
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="XE " & """" & xe & """", PreserveFormatting:=False xP XoJN
Case "正文" j)<;g(
'正文名称段落设置 CZF^Wxk
.Paragraphs(paraCounter).Style = "QLNU正文" ',:3>{9
Case "文献条目" }#1UD
With .Paragraphs(paraCounter) ^tQPJ
'.Range.Select 3/SfUfWo
'Selection.ClearFormatting K3j_C`Se
'.Range.Find.Execute findtext:=rText, replacewith:=strSeperator 'Replacetext 传回了编号及分隔符部分, 而StrSeperator传回了正确的格式与分隔符如“[15] ” '9f6ZAnYpQ
.Style = "QLNU参考文献" NJ.rv
End With X>3iYDe
Case "图表注解" o7m99(
With .Paragraphs(paraCounter) N `J:^,H
.Range.Font.NameFarEast = "楷体" tX+0 GLz
.Range.Font.NameAscii = "Times New Roman" v`@5enr
.Range.Font.Size = 9 '小5号字 2*N&q|ED
;O
Q#@|D
.Alignment = wdAlignParagraphCenter /j`i/Ha1
.LeftIndent = 0 <WO&$&
.RightIndent = 0 )r-T=
.FirstLineIndent = 0 f34_?F<h
.LineSpacing = 12 zw}@nqp
.LineSpacingRule = wdLineSpaceExactly CX1L(Y[
.LineUnitAfter = 0 ~ W2:NQ>i
.LineUnitBefore = 0 F">Nrj-bs
.OutlineLevel = wdOutlineLevelBodyText -$'~;O3s
.PageBreakBefore = False tq2-.]Y@U
.RightIndent = 0 oXnC"y}0P
.WordWrap = True B?$S~5
}
.LineUnitAfter = 0.5 t`N
">c"
&19lk
End With b5lk0 jA
Case Else ?ykVf O'
'不作处理 xhw8#
End Select )e@01l
@$2`DI{_^
'含有inlineshape的段落处理 PWADbu{+
If ShapeHeight > 30 Then + 8MW$ m$
.Paragraphs(paraCounter).LineSpacingRule = wdLineSpaceSingle '对有图片的段落设置为单倍行距 Tnzco
End If #9URVq,
=1%zI%
If (ShapeWidth + ShapeHeight) > 150 Then AN|jFSQ'
.Paragraphs(paraCounter).Style = "QLNU图片段落" Y:DNu9
End If R>Z
,TQU
7qCJ]%
)b6
'段落计数器递 #|)JD@;Q
paraCounter = paraCounter + 1 6 ,7/8
Me.lbCounter.Caption = "当前检测段落:" & paraCounter LsuAOB 8
Me.txtStatus.Text = ParaText 3?a0
+]
DoEvents
%i;r]z-
Loop Oz"@yL}
End With 0sq=5 BnO
9O(i+fM
msg = "" `V?x
xq\
rD:gN%B=
For i = 0 To Me.ErrMsg.ListCount - 1 jydp4ek_n
msg = msg & vbCrLf & vbCrLf & Me.ErrMsg.List(i) x.
j Yip
Next Km|
9Too
ls8olLM>
9^6|ta0;0
_C7abw-
Me.txtStatus.Text = "格式化完成!" & vbCrLf & "开始时间:" & tm1 & vbCrLf & "结束时间:" & Now & vbCrLf & msg ;u4@iN}p
Me.cmdCheck.Enabled = True $)kk8Q4+K
Me.txtStatus.Visible = True (OM?aW
Me.lbParaType.Visible = False IKNFYe[9e
Q
`J,dzY
bContinue = False }CB=c]p
End Sub @2x0V]AI
<~IH`
Sub CheckPara(ByRef ChKRange As Range, ParaType As String, ReplaceTEXT As String, TitleString As String, TitleNo As String, shpCounter As Long, MaxShpHeight As Long, TotalShpWidth As Long) T%M1[<"Q
Dim pTEXT As String fvAh?<Ul
T4%i`<i
pTEXT = ChKRange.Text G%V=idU*"
}qgqb
ParaType = "其它" r[C3u[
TitleString = pTEXT z&>9
s)^-
TitleNo = "N/A" WLg6-@kxXs
GC5#1+fQ
shpCounter = ChKRange.InlineShapes.Count q/W{PBb-2k
If shpCounter <> 0 Then ~9`^72
MaxShpHeight = 0: TotalShpWidth = 0 L%c
]%3A
For i = 1 To shpCounter |G`4"``]k
k = ChKRange.InlineShapes(i).Height ):|G
kSm
l = ChKRange.InlineShapes(i).Width Y yQf
If k > MaxShpHeight Then [TiTff&LV
MaxShpHeight = k 7
I2a*4}
End If pgLzFY['
TotalShpWidth = TotalShpWidth + l MEdIw#P.}{
Next T! &[
If MaxShpHeight > 60 Or TotalShpWidth > 150 Then M"$jpBN*
Exit Sub |r)>bY7
End If 7Va#{Y;Zy
End If 3{N p 9y.
N"q+UCRC
'空行 6xDl=*&%
If Len(pTEXT) <= 2 Then J4Q)`Y\~
Exit Sub sRo<4U0M;l
End If ~:P8g<w
rw}5nv
2n-Tpay0
'是否为表格中的文字 orcZyYU
If ActiveDocument.Paragraphs(paraCounter).Range.Information(wdWithInTable) Then :IP;FrcMP
ParaType = "表格内容" *:fw6mnJ#
k = ActiveDocument.Paragraphs(paraCounter).Range.Information(wdEndOfRangeRowNumber) !`O_VV`/@
If k = 1 Then g:~?U*f-
ParaType = "表格首行" Nqo#sBS
End If ?3B t;<^
Exit Sub *@$($<pY&
End If H{
Y5YTg]
Lz#$_Am'H
'例外情况:脚注 qd#(`%_/
If ActiveDocument.Paragraphs(paraCounter).Range.Information(wdInFootnote) Then {2'74
ParaType = "脚注" YoSo0fQA
Exit Sub
s+y'<88
End If +O.&64(
X:xC>4]gG'
'例外情况:尾注 ne!j%9Ar
If ActiveDocument.Paragraphs(paraCounter).Range.Information(wdInEndnote) Then 9TbS>o
ParaType = "尾注" Knw'h;,[
Exit Sub q/ d5P
End If dw{#||
Q G=-LXv:@
If ActiveDocument.Paragraphs(paraCounter).Range.Information(wdInHeaderFooter) Then 3isXgp8
ParaType = "页眉页脚" e4>L@7
Exit Sub VO
owA^
End If Pq[0vZ_}dN
XNkQk0i;g&
Se;?j-
With regEX =
C$@DNEc
.Global = True WwCK K
Rsa\V6N>
.Pattern = "^第([1-9]|1|2|3|4|5|6|7|8|一|二|三|四|五|六|七|八|九|十)章(、|\.|\s|。|.)+(.{1,30})$" 110>p
If regEX.Test(pTEXT) Then -Y
6.?z
ReplaceTEXT = regEX.Replace(pTEXT, "第$1章 $3") ulz\x2[Pf
TitleString = regEX.Replace(pTEXT, "$3") 82Z[eo
TitleNo = regEX.Replace(pTEXT, "$1") s)o,Fi
ParaType = "章" Y*5@|Q
Exit Sub V1CSXY\2
End If ZF/J/;uI
_Vk,&