-->

How to disable File button in MS-Word 2013?

2020-08-03 09:02发布

问题:

I want to disable File button. For example, I have this code.

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    <backstage>
        <button idMso="FileSave" visible="false"/>
        <button idMso="FileSaveAs" visible="false"/>
        <button idMso="FileOpen" visible="false"/>
        <button idMso="FileClose" visible="false"/>
        <button idMso="ApplicationOptionsDialog" visible="false"/>
        <button idMso="FileExit" visible="false"/>
        <button idMso="HistoryTab" visible="false"/>
        <button idMso="OfficeFeedback" visible="false"/>
        <button idMso="ShareDocument" visible="false"/>

        <tab idMso="TabInfo" visible="false"/>
        <tab idMso="TabRecent" visible="false"/>
        <tab idMso="TabNew" visible="false"/>
        <tab idMso="TabPrint" visible="false"/>
        <tab idMso="TabShare" visible="false"/>
        <tab idMso="TabHelp" visible="false"/>
        <tab idMso="TabPublish" visible="false"/>
        <tab idMso="TabSave" visible="false"/>
        <tab idMso="TabOfficeStart" visible="false"/>
    <tab idMso="Publish2Tab" visible="false"/>
    <tab idMso="TabOfficeFeedback" visible="false"/>
    </backstage>
</customUI>

This code controls only the backstage tab, not the File button. I want to control the file button directly.

The best way I think is to keep the file button invisible.

How can I control File button using this method? Or is there a better way?

回答1:

It's not possible to hide this button - this is by design. Even using <ribbon startFromScratch="true"> won't hide it.

I sat in a few sessions back when Microsoft introduced the Ribbon, more than 10 years ago. As I recall, the reason given was that an Office application is an end-user tool, licensed to the user; developers are "guests". The user should therefore retain a certain, minimum control of their software. This was a reaction to developers (and hackers) "hijacking" Office applications using the previous user interface (command bars), locking users out. Since that introductory stage, more possibilities for making these "protected" commands inaccessible have been provided, but the most important ones cannot be hidden/removed. That way, the user can at least recognize that the commands could/should be present (which can be important when trouble-shooting when a user says "it's not working").