Office Web应用程序 - 删除按钮

时间:2016-07-08 13:37:27

标签: ms-office office-web-components

有没有办法从Office网络应用中删除按钮或完整功能区。我想删除下载,添加到一个驱动器等。

示例网址位于

之下

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

3 个答案:

答案 0 :(得分:1)

您必须编辑相应的css文件: .Class或#ID等 display:none;

Word可以在: “[在这里开车]:\ microsoftwebapps \ WebOneNote \ Resources \ 1033 \ WordEditor.css”

Excel可以在以下位置找到: “[在这里开车]:\ microsoftwebapps \ ExcelServicesWfe_layouts \ styles \ excelribbon.css”

PowerPoint可以在以下位置找到: “[在这里开车]:\ microsoftwebapps \ WebPPTViewer \ pptresources \ 1033 \ stylesEdit.css”

我使用IE的DOM浏览器来定位特定的类&我想删除的按钮的ID。

祝你好运,这是一个巨大的痛苦啊

一个例子是

“#btnOpenInClient {显示:无;}”

这是我的第一个答案。我没有时间格式化,但它应该有所帮助。我确实为我的OWAs做了这个

答案 1 :(得分:0)

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.

答案 2 :(得分:0)

下面的powershell脚本应达到以下目的: 请根据您的目的调整$ hideElements数组。

添加自定义CSS,以在“文件”菜单中隐藏多个选项(“信息”,“另存为”,“打印”,“共享”,“退出”)   将要修改的OWA CSS文件: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
    }
}