惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
T
Tailwind CSS Blog
Recent Announcements
Recent Announcements
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
P
Proofpoint News Feed
D
Docker
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
IT之家
IT之家
H
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
B
Blog
D
DataBreaches.Net

博客园 - 禹过天晴

TextControl技术互助 博文阅读密码验证 - 博客园 (转)不通过web.config在运行时注册httpmodules (学)如何在Oracle中一次执行多条sql语句 (学)条件性唯一性索引的建议 阿里云服务器IIS启用HTTPS协议(转) (学)递归查找窗体中全部控件 博文阅读密码验证 - 博客园 如何让Oracle表及字段显示为区分大小写(转) (转)SQL Server 列转行 博文阅读密码验证 - 博客园 (转)基于SQL的EAN13、ENA8条形码校验位生成 博文阅读密码验证 - 博客园 (原)将Oracle迁移到SQLServer (转)Sql Server 快速查看表结构(表描述及字段说明) 博文阅读密码验证 - 博客园 (转)SQL查询案例:多行转换为一行 (转)找回vss超级管理员密码 (转)SqlServer里DateTime转字符串
(原)用WebBrowser浏览Office Web Apps Server,除去“下载”按钮
禹过天晴 · 2018-01-05 · via 博客园 - 禹过天晴

对,没错,如果你按关键字找到这篇随笔了,相信一定知道背景,以及我所说的是什么。


上一段子代码。

private void timerHideButton_Tick(object sender, EventArgs e)
        {
            try
            {
                HtmlDocument htmlDoc = webBrowser.Document;
                if (webBrowser.Document != null) 
                    htmlDoc = webBrowser.Document.Window.Frames["wacframe"].Document;
                if (htmlDoc == null)
                    return;

                var toolBar = htmlDoc.GetElementById("PptUpperToolbar.LeftButtonDock");    //PPT、PPTX
                if (toolBar == null)      
                    toolBar = htmlDoc.GetElementById("stripLeft");                 //DOC、DOCX、PDF
                if (toolBar == null)
                    toolBar = htmlDoc.GetElementById("m_excelWebRenderer_ewaCtl_stripLeft"); //XLS、XLSX

                if (toolBar != null)
                {
                    toolBar.InnerHtml = "";
                    timerHideButton.Enabled = false;
                }
            }
            catch (Exception ex)
            {
               Console.WriteLine(ex.Message);
            }
        }

  张三问了:还用个Timer,不科学,你应该把代码放到
                         webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e);

       回答:原先我也是这么想的,但是、可是因为 iframe 的原因,Completed事件可能会被激活多次,并且直到最后一次也不能准确得到预期结果。