我可以更改 Word (2007) 自动创建项目符号列表时使用的列表样式吗?
我有一个模板,在其中创建了自定义列表样式,并确保当用户单击功能区上的“项目符号”图标时使用该列表样式(通过覆盖 FormatBulletDefault
)。
但是,如果用户输入:
* foo
...然后 Word 会自动使用“错误”(默认)列表样式将其转换为项目符号列表,这不是我想要使用的样式。这意味着用户最终会得到格式错误的列表。
如果我可以为我的模板关闭“自动创建项目符号列表”设置,那么我可能会考虑这样做,但这是一个应用程序设置,我不想为所有文档关闭它。
有什么方法可以拦截项目符号列表的自动创建吗?或者更改它使用的列表样式?
I have a template where I've created a custom list style, and ensured that that list style is used when the user clicks on the "bullet" icon on the ribbon (by overriding FormatBulletDefault
).
However, if the user types:
* foo
...then Word will automatically turn that into a bulleted list using the "wrong" (default) list style, which is not the one I want to use. This will mean that users end up with wrongly-formatted lists.
If I could turn off the "automatically create bulleted lists" setting for my template, then I might consider that, but it's an application setting, and I don't want to turn it off for all documents.
Is there any way to intercept the auto-creation of a bulleted list? Or to change the list style it uses?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道有什么方法可以拦截此行为,因为它是由 Word 的“键入时自动更正自动套用格式”功能引起的。不过,您可以暂时关闭“键入时应用|自动项目符号列表”行为。为此,请将以下代码添加到 Private Sub Document_Open():
这将全局关闭 Word 的此功能(因此将影响同时打开的文档),但如果在 Private Sub Document_Close() 中包含相反的操作:
设置将被恢复。您可以在此处找到“键入时自动套用格式”功能的 Word 对象模型映射:
http://technet.microsoft.com/en-us/library/Ee692775.big_asyoutype(en-us,TechNet.10).jpg
以及一篇解释这些设置的 VBA 实现的文章此处:
http://technet.microsoft.com/en-us/library/ee692775.aspx
I do not know of any way to intercept this behavior as it is being caused by Word's AutoCorrect AutoFormat As You Type functionality. However you can turn off the Apply as you type|Automatic bulleted lists behavior temporarily. To do so, add the following code to Private Sub Document_Open():
This will turn off this functionality for Word globally (and as such will affect concurrently opened documents), but if you include the reverse in Private Sub Document_Close():
the setting will be restored. You can find the Word object model mappings for the AutoFormat As You Type functionality here:
http://technet.microsoft.com/en-us/library/Ee692775.big_asyoutype(en-us,TechNet.10).jpg
and an article explaining the VBA implementation of these settings here:
http://technet.microsoft.com/en-us/library/ee692775.aspx