【发布时间】:2016-10-12 14:13:19
【问题描述】:
我正在使用 VSTO(在 VB 中)构建 Word 加载项,但我遇到了一个非常烦人的问题。我想在删除文档的每个故事中的所有内容控件时关闭 ScreenUpdating。所以我做了以下事情:
Application.ScreenUpdating = False
'loop through all open documents
For Each thisDoc As Word.Document In gbl_docList
'loop through all stories in each doc
For Each thisStoryRange As Word.Range In thisDoc.StoryRanges
thisDoc.Activate() 'active this doc so we can work on it
thisStoryRange.Select() 'select the range
'remove all Content Controls
For Each thisCC As Microsoft.Office.Interop.Word.ContentControl In thisStoryRange.ContentControls
thisCC.Delete() 'remove this CC
Next 'next CC
Next 'next story
Next 'next doc
Application.ScreenUpdating = True
但是,每当 Word 循环浏览页眉或页脚故事时,它就会开始在屏幕底部打开一个面板并将其显示给用户,这会导致尴尬的闪烁。如果没有页眉/页脚,一切正常。
问题:
有人遇到过这个问题吗?有什么建议么?
作为替代解决方案,有没有办法在 Word 中最小化/隐藏 Word 文档但保持 Word 窗口打开?我只能找到最小化/隐藏所有 Word 的方法。
【问题讨论】:
标签: .net vb.net ms-word vsto add-in