好的,所以基本上我们在 Word 2007 的启用宏的模板中有几个独特的部分,对于每个部分,我们有 2 个表单标准条目,然后有大约 20 个可选条目,它们都由自动图文集处理. 模板和自动图文集条目之间的格式相同,我想在添加条目时自动编号(通过用户键入自动图文集关键词或点击功能区上的按钮插入它)。是否有捷径可寻?这是处理这些(编号)条目之一的代码块,以及我尝试从其他论坛上的其他建议中实现的编号方案(在这里找不到任何有用的东西):
Case "cboFF"
SetMargins 0, 1, 1
Selection.ParagraphFormat.Space1
Selection.Text = "FINDINGS OF FACT" & vbLf
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Font.Bold = True
Selection.Font.Underline = wdUnderlineSingle
Selection.Collapse (wdCollapseEnd)
Selection.Text = vbLf
Selection.ParagraphFormat.SpaceAfter = 6
Selection.Collapse (wdCollapseEnd)
Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
Selection.Font.Underline = wdUnderlineNone
Selection.Font.Bold = False
SetMargins 0, 1, 1
'With ListGalleries(wdNumberGallery).ListTemplates(1).ListLevels(1)
'.NumberFormat = "%1."
'.TrailingCharacter = wdTrailingTab
'.NumberStyle = wdListNumberStyleNone
'.NumberPosition = InchesToPoints(0.5)
'.Alignment = wdListLevelAlignLeft
'.TextPosition = InchesToPoints(0.5)
'.ResetOnHigher = 0
'.StartAt = 1
'AutoNumberOnFOF
Selection.Text = "On " & strDateFOF & ", an industrial appeals judge certified that the parties agreed to include the Jurisdictional History in the Board record solely for jurisdictional purposes." & vbLf
Selection.ParagraphFormat.SpaceAfter = 6
Selection.Collapse (wdCollapseEnd)
Select Case strCaseCategory
Case "IND", "IND SELF-I"
If frmIIOD.optII.Value = True Then
Selection.Text = "II-FF"
Selection.Range.InsertAutoText
Selection.Collapse (wdCollapseEnd)
Selection.Text = vbLf
Selection.ParagraphFormat.SpaceAfter = 6
Selection.Collapse (wdCollapseEnd)
GoToEnd
End If
If frmIIOD.optOD.Value = True Then
Selection.Text = "OD-FF"
Selection.Range.InsertAutoText
Selection.Collapse (wdCollapseEnd)
Selection.Text = vbLf
Selection.ParagraphFormat.SpaceAfter = 6
Selection.Collapse (wdCollapseEnd)
GoToEnd
End If
If frmIIOD.optNotNeeded.Value = True Then
Selection.Text = vbLf
Selection.ParagraphFormat.SpaceAfter = 6
Selection.Collapse (wdCollapseEnd)
End If
Case Else
'Do Nothing
End Select
任何建设性的意见将不胜感激,以帮助解决这个问题。我对整个编程仍然很陌生,我的大部分经验都在 C# 和 Java 上。
编辑:文档的结构本质上是一组包含法律文本的逐项列表,当上诉过程经历各个阶段时,用户会对其进行更新。在最后 2 节中的每一个中,逐项列表都需要遵循特定的编号方案(数字为 0.5",文本为 1",右制表符为 1"),这不是 Word 2007 所固有的。每个都有一个粗体标题作为编号起点的部分。自动图文集条目将根据用户的需要添加。文档的其余部分从我们的数据库中提取信息并包含文档所需的法律措辞。如果我能弄清楚如何分别为每个部分启动编号,然后我可以完成它。