Office文档在线编辑的一个实现方法(office文件在线编辑)深度揭秘

随心笔谈11个月前发布 admin
112 0

function Document_Edit2( url )

{

if( __OpenDocuments==null )

{

try{

__OpenDocuments=new ActiveXObject(“SharePoint.OpenDocuments.3”); //for office 2007

}catch(e){}

if( __OpenDocuments==null || typeof(__OpenDocuments)==”#ff0000″ )

{

try{

__OpenDocuments=new ActiveXObject(“SharePoint.OpenDocuments.2”); //for office 2003

}catch(e){}

}

if( __OpenDocuments==null || typeof(__OpenDocuments)==”undefined” )

{

alert( “请安装Word(2003或更高版本)” );

return ;

}

}

// openDocObj.ViewDocument(“http://www.abc.com/documents/sample.doc”);, “Word.Document”

//openDocObj.CreateNewDocument(“http://www.abc.com/documents/sampleTemplate.dot”, “http://www.abc.com/documents/”);

var result=__OpenDocuments.EditDocument( url , “Word.Document” );

if( result==false )

{

alert( “无法打开文档.” );

}

}

© 版权声明

相关文章