我一直在使用 TOleContainer 在我的应用程序中将 MS Word 显示为编辑器。从上周(2022 年 5 月 3 日)开始,TOleContainer 并未嵌入 MS Word。相反,Word 将作为单独的屏幕打开:
如果在未关闭 ms word 的情况下关闭表单,则会留下一个空的 word 容器。如果关闭 MS Word,则无法引用嵌入在 TOleContainer 中的 TWordDocument
任何帮助将不胜感激。
我在 Office 365 et RAD Studio 11 (Delphi) 中遇到了同样的问题
我刚刚从 Office 2019 更新到 Office 365,更新后立即出现问题
目前还没找到解决办法。
这是我的Delphi代码,10年来没有改变并且一直有效
OleContainerWord.CreateObject('Word.Document', False);
OleContainerWord.AllowInPlace := True;
if OleContainerWord.State > osEmpty then
OleContainerWord.DoVerb(ovShow);
如果有人有想法,我们会洗耳恭听:)
您可以尝试将以下内容添加到您的应用程序清单中,然后重新编译
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:application>
<asmv3:windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">system</dpiAwareness>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
您还需要在“文件”>“选项”>“常规”下将单词设置为“优化兼容性”
https://stackoverflow.com/questions/73134923/delphi-olecontainer-for-wps/73926149#answer-73926149
尝试这个答案。
我正在上网,决定看看是否可以搜索答案,看来你也会遇到同样的问题。
当您尝试将 64 位控件嵌入到 32 位容器中时会发生这种情况,反之亦然。确保安装与应用程序的位大小体系结构兼容的 Office 版本。 有关激活 OLE 服务器(又名 TOleContainer)的信息,请参阅“选择 32 位版本的原因”部分中的Microsoft 建议。