开发者

Disable Word 2010 commands on a document level

We want to disable any and all formatting and insertion commands in Word except for bold and italic in all documents that are created from a certain template. It should not be possible to change styles, insert anything but text, or change character formatting at all (except for the aforementioned bold and开发者_如何学C italic formats). Is there a way to achieve this?

Maybe it would be possible to disable these commands with a VBA autostart macro in the template?


The only way would be to hook the WindowSelectionChange(ByVal Sel As Selection) event and catch any change that is not a character, bold format or italic format. I guess it would be a fair amount of coding to set this up.


I figured out how to do this with RibbonX. For example, to disable the bold command, add this RibbonX XML to the document or template:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    <commands>
        <command idMso="Bold" enabled="false"/>
    </commands>
</customUI>

Of course, the user can still paste bold text.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜