zoukankan      html  css  js  c++  java
  • The associated COM server does not support ActiveX Document embedding

    通过dsoframer实现读取excel文件报错:

    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80041103): The associated COM server does not support ActiveX Document embedding.

       at DSOFramer._FramerControl.Open(Object Document, Object ReadOnly, Object ProgId, Object WebUsername, Object WebPassword)

       --- End of inner exception stack trace ---

    解决方法:

    Open时把第三个progID加上就可以,

    2.  HRESULT Open([in] VARIANT Document, [in, optional] VARIANT ReadOnly, 
    [in, optional] VARIANT ProgId, [in, optional] VARIANT WebUsername, [in, optional] VARIANT WebPassword)
        打开文档,可以是本地文件或者是服务器文件
    参数:
    Document  文档路径
    ReadOnly  是否已只读模式打开
    ProgId    OLE类型
    WebUsername  用户名(访问网络的文件时候,有可能需要)
    WebPassword  密码
    例子:

    axFramerControl1.Open(sPath, true, "Excel.Sheet", "", "");//
    DsoFramer1.Open "C:TestBook.xls"
    DsoFramer1.Open "C:Plain.txt", , "Word.Document"  //用Word来打开c:plain.txt文件
    DsoFramer1.Open "https://secureserver/test/mytest.asp?id=123", True, "Excel.Sheet", "MyUserAccount", "MyPassword"

    3.HRESULT Save([in, optional] VARIANT SaveAsDocument, [in, optional] VARIANT OverwriteExisting, 
                    [in, optional] VARIANT WebUsername, [in, optional] VARIANT WebPassword);
    保存文件在本地

    DsoFramer1.Save "c:1.doc"

      <SCRIPT language="javascript" event="NotifyCtrlReady" for="FramerControl1">        
            function OpenHelpDoc()
            {
                document.all.FramerControl1.Open("../photofile/<%=Request.QueryString["FilePath"] %>", true,"Word.Document");
            }
            OpenHelpDoc();        
        </SCRIPT>
  • 相关阅读:
    [2020.12.5周六]Boruvka
    [2020.12.4周五] 圆上对称博弈
    [2020.12.3周四]最长上升子序列
    置顶~ 未来半年内训练计划
    cf1473d
    cf1474D
    寒假复健第一天 cf1475D
    来啦来啦,寒假复健第一题cf1475g
    12.1加训总结 2019南京
    12.7-12.13训练计划
  • 原文地址:https://www.cnblogs.com/kennyliu/p/3964618.html
Copyright © 2011-2022 走看看