Office web app - Remove buttons

2.3k Views Asked by At

Is there any way to remove buttons or complete ribbons from Office web apps. I want to remove Download, Add to one drive etc.

Sample url is below

https://view.officeapps.live.com/op/view.aspx?src=www.cse.lehigh.edu%2F~glennb%2Foose%2Fppt%2FCsharp_dotNET.ppt

3

There are 3 best solutions below

0
On

There's no other helpful way to say this other than "no, it's not possible". Only the client Office Applications allow UI customizations, but those are limited to hiding or disabling Ribbon components.

0
On

The bellow powershell script should serve the purpose: Please adjust $hideElements array accordingly to your purpose.

Add custom css to hide multiple options in File menu (Info, Save as, Print, Share, Exit) OWA CSS files that will be modified: WordEditor.css, WordViewer.css, stylesEdit.css, stylesRead.css, ExcelFrame.css

param (
    [Parameter(Mandatory=$true)][string]$action
)
$action = $action.ToLower()
$acceptedActions = "apply","rollback"

if ($acceptedActions -notcontains $action) {
    throw "Invalid action. Accepted actions: apply,rollback"
}

$owaPath = "C:\Program Files\Microsoft Office Web Apps"

$hideElements = "#_x{} a[id$=Save-Menu32]{display:none;} a[id$=SaveAs-Menu32]{display:none;} a[id$=Print-Menu32]{display:none;} a[id$=Share-Menu32]{display:none;} a[id$=Close-Menu32]{display:none;} #btnOpenInClient-Medium{display:none;} #btnFileSharing-Medium{display:none;}";

$cssFiles =  "$owaPath\WebOneNote\Resources\1033\WordEditor.css", "$owaPath\WebPPTViewer\pptresources\1033\stylesEdit.css", "$owaPath\WebWordViewer\Resources\1033\WordViewer.css", "$owaPath\WebPPTViewer\pptresources\1033\stylesRead.css", $owaPath\ExcelServicesWfe\_layouts\1033\styles\ExcelFrame.css"

function ApplyPatch($cssFile, $hideElements) {
    if(-Not (Get-Content $cssFile).Contains($hideElements)) {
        $cssBackupFile = "$cssFile.bak"
        Copy-Item -Path $cssFile -Destination $cssBackupFile -Force
        Add-Content $cssFile $hideElements
        Write-Host "Patch applied on $cssFile"
    } else {
        Write-Warning "Patch already applied on $cssFile."
    }
}

function RollbackPatch($cssFile, $hideElements) {
    $cssBackupFile = "$cssFile.bak"
    if((Test-Path $cssBackupFile) -eq 1) {
       Copy-Item -Path $cssBackupFile -Destination $cssFile -Force
       Remove-Item $cssBackupFile
       Write-Host "Rollback applied on $cssFile"
    } else {
       Write-Warning "Missing backup file for $cssFile. Cannot rollback"
    }
}

If($action -eq "apply") {
    foreach ($cssFile in $cssFiles) {
        ApplyPatch $cssFile $hideElements
    }
}

If($action -eq "rollback") {
    foreach ($cssFile in $cssFiles) {
        RollbackPatch $cssFile $hideElements
    }
}
1
On

You have to edit the appropriate css files to: .Class or #ID etc. display: none;

Word can be found in: "[drive here]:\microsoftwebapps\WebOneNote\Resources\1033\WordEditor.css"

Excel can be found in: "[drive here]:\microsoftwebapps\ExcelServicesWfe_layouts\styles\excelribbon.css"

PowerPoint can be found in: "[drive here]:\microsoftwebapps\WebPPTViewer\pptresources\1033\stylesEdit.css"

I used IE's DOM explorer to target specific classes & IDs of the buttons I wanted to remove.

Good luck, it is a huge pain in the a**

An example would be

"#btnOpenInClient{display:none;}"

This is my first answer. I didn't really have time to format, but it should help. I literally jsut did this for my OWAs