zoukankan      html  css  js  c++  java
  • [记录] Host Office Document In WebBrowser control in a Windows Form Application.

    How to use the WebBrowser control to open Office documents in Visual C# 2005 or in Visual C# .NET
    http://support.microsoft.com/?scid=kb%3Ben-us%3B304662&x=11&y=11

    According to this link, we should edit the registry key first if we use IE 7 and onword.

    Added the .reg file as follow.

    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.Document.8]
    "BrowserFlags"=dword:80000024
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.RTF.8]
    "BrowserFlags"=dword:80000024
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.Document.12]
    "BrowserFlags"=dword:80000024
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.DocumentMacroEnabled.12]
    "BrowserFlags"=dword:80000024
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.Sheet.8]
    "BrowserFlags"=dword:80000A00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.Sheet.12]
    "BrowserFlags"=dword:80000A00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.SheetMacroEnabled.12]
    "BrowserFlags"=dword:80000A00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.SheetBinaryMacroEnabled.12]
    "BrowserFlags"=dword:80000A00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PowerPoint.Show.8]
    "BrowserFlags"=dword:800000A0
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PowerPoint.Show.12]
    "BrowserFlags"=dword:800000A0
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PowerPoint.ShowMacroEnabled.12]
    "BrowserFlags"=dword:800000A0
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PowerPoint.SlideShow.8]
    "BrowserFlags"=dword:800000A0
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PowerPoint.SlideShow.12]
    "BrowserFlags"=dword:800000A0
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PowerPoint.SlideShowMacroEnabled.12]
    "BrowserFlags"=dword:800000A0

    Please do backup the registry keys before changing.

    *** It still works on office 2010. The webbrowser control can be the control in the Access form. 

    However, it offers us a way to open office document in a winform. Somebody wants to show blank .doc document in a winform without showing the toolbar.  Maybe more efforts should be put into the following code line:

    Object refmissing = System.Reflection.Missing.Value;
     axWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_HIDETOOLBARS, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER,ref refmissing , ref refmissing);
  • 相关阅读:
    php 中的 Output Control 函数
    web安全知识
    php写一个web五子棋
    实现一个web服务器, 支持php
    字节序
    TinyHTTPd源码分析
    linux 管道通信
    linux网络编程
    微信公众号开发-静默授权实现消息推送(微服务方式)
    初学 Nginx
  • 原文地址:https://www.cnblogs.com/yoyohappy/p/2341810.html
Copyright © 2011-2022 走看看