china_xian
一星級

文章: 1
|
 |
« 於: 六月 27, 2009, 04:00:34 上午 » |
|
目前新標程式未提供“預覽”功能(即按現代文分段形式預覽展示經文),這樣新標義工在初步標註標點后,難以直觀地進行校對和修改。我目前用Word2003宏來實現這個簡單的預覽功能,只要在新標程式中把經文全部複製到Word中,然後運行以下這個宏,即能在Word中展現為現代文分段形式,能很方便直觀地進行校對。 Word宏在附件中可下載。使用方法:Word中打開“工具”-“宏”-“VisualBasic編輯器”-“文件”-“導入文件”-將解壓縮后的CBETA_XB_Preview.bas導入-保存退出返回Word,之後便可以使用這個宏了。
附宏代碼: Attribute VB_Name = "CBETA_XB" Sub CBETA_XB_Preview() Dim para As Paragraph Dim newLines, paraText, paraPre As String For Each para In ActiveDocument.Paragraphs paraText = Replace(para.Range.Text, Chr(13), "") If Len(paraText) >= 20 And Mid(paraText, 1, 1) = "T" And Mid(paraText, 20, 1) = "#" Then paraPre = Left(paraText, 20) paraText = Right(paraText, Len(paraText) - 20) If Mid(paraPre, 18, 1) <> "_" Then paraText = "<P>" & paraText End If newLines = newLines & paraText End If Next newLines = Replace(newLines, "}}", "") newLines = Replace(newLines, "P", "<P>") ActiveDocument.Range.Text = newLines Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "\{\{*||" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = True .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "<P>" .Replacement.Text = "^p " .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub
|