document.all.FramerControl1.CreateNew("Word.Document");
document.all.FramerControl1.CreateNew("Excel.Sheet");
document.all.FramerControl1.Open("C:\\TestBook.xls");
document.all.FramerControl1.Open("C:\\Plain.txt",false, "Word.Document");
document.all.FramerControl1.Open("http://localhost/1.doc", true);
document.all.FramerControl1.Save("c:\\1.doc",true);
/*增加Http协议Post上传接口,可以Post一个动态页面(jsp,asp,php...),由动态页面负责解析数据
bool HttpAddPostString(BSTR strName, BSTR strValue);
bool HttpAddPostCurrFile(BSTR strFileID, BSTR strFileName);
document.all.FramerControl1.HttpInit();
document.all.FramerControl1.HttpAddPostString("RecordID","20060102200");
document.all.FramerControl1.HttpAddPostString("UserID","李局长");
document.all.FramerControl1.HttpAddPostCurrFile("FileData", "文档名.doc");
document.all.FramerControl1.HttpPost("http://xxxx.com/uploadfile.asp");
document.all.FramerControl1.SetTrackRevisions(1);
document.all.FramerControl1.SetTrackRevisions(0);
document.all.FramerControl1.SetTrackRevisions(4);
document.all.FramerControl1.SetCurrUserName("张三");
6.设置当前时间(笔迹留痕会显示("Like 2006:02:07 11:11:11")
document.all.FramerControl1.SetCurrTime("2006:02:07 11:11:11");
7.设置和创建书签,此功能比较强大,设置书签数据、添加书签和添加红头文件就靠他了
SetFieldValue(BSTR strFieldName, BSTR strValue, BSTR strCmdOrSheetName)
一般来说:WORD中书签是做好的,可以通过此接口把外界数据设置进书签中去。
//在当前WORD位置插入标签,标签名为"book1",数值为"test"
document.all.FramerControl1.SetFieldValue("book1","test","::ADDMARK::");
//设置书签"Time",数值为"2006-03-16 22:22:22"
document.all.FramerControl1.SetFieldValue("Time","2006-03-16 22:22:22","");
//在书签位置"hongtou",插入红头文件"http://222.222.222.222/hongtou1.doc" 这样,红头就自动插进去了
BOOL SetMenuDisplay(long lMenuFlag)
document.all.FramerControl1..SetMenuDisplay(1);
document.all.FramerControl1.SetMenuDisplay(2);
document.all.FramerControl1.SetMenuDisplay(3);
document.all.FramerControl1.ProtectDoc(1,1,"pwd");
document.all.FramerControl1.ProtectDoc(0,1,"pwd");
document.all.FramerControl1.ShowRevisions(1);
document.all.FramerControl1.ShowRevisions(0);
strFieldPath 文件路径,可以是http,ftp的路径
InSertFile(BSTR strFieldPath, long lPos)
document.all.FramerControl1.InSertFile("http://XX.com/XX.doc",1);
document.all.FramerControl1.InSertFile("http://XX.com/XX.doc",2);
document.all.FramerControl1.InSertFile("http://XX.com/XX.doc",0);
document.all.FramerControl1.InSertFile("http://XX.com/XX.jpg",9);
document.all.FramerControl1.InSertFile("http://XX.com/XX.jpg",10);
document.all.FramerControl1.InSertFile("http://XX.com/XX.jpg",8);
HRESULT SaveAs([in] VARIANT strFileName, [in] VARIANT dwFileFormat, [out,retval] long* pbool);
strFileName:文件本地路径,如c:\\11.doc
xlCurrentPlatformText = -4158,
wdFormatDOSTextLineBreaks = 5,
ppSaveAsPowerPoint4FarEast = 10,
HRESULT DeleteLocalFile([in] BSTR strFilePath);
strFileName:文件本地路径,如c:\\11.doc
HRESULT GetTempFilePath([out,retval] BSTR* strValue);
临时文件的路径地址。使用完后,用DeleteLocalFile 删除
HRESULT ShowView([in] long dwViewType, [out,retval] long * pbool);
document.all.FramerControl1.ShowView(5);
HRESULT DownloadFile( [in] BSTR strRemoteFile, [in] BSTR strLocalFile, [out,retval] BSTR* strValue);
strRemoteFile:远程路径地址,http or Ftp
strLocalFile: 本地保存地址,if strLocalFile == NULL then Create Temp File and return TempFile's Path
HRESULT HttpAddPostFile([in] BSTR strFileID, [in] BSTR strFileName, [out,retval] long* pbool);
GetRevCount( [out,retval] long * pbool);
GetRevInfo([in] long lIndex, [in] long lType, [out,retval] BSTR* pbool);
vCount = document.all.FramerControl1.GetRevCount();
for(var i=1; i<= vCount; i++){
vOpt = document.all.FramerControl1.GetRevInfo(i,2);
vDate = new String(document.all.FramerControl1.GetRevInfo(i,1));
HRESULT SetValue([in] BSTR strValue, [in] BSTR strName, [out,retval] long* pbool);
SetValue("password","::DOCPROP:PassWord");
SetValue("password","::DOCPROP:WritePW");
document.all.FramerControl1.SetValue("password","::DOCPROP:PassWord");
document.all.FramerControl1.SetValue("password","::DOCPROP:WritePW");
想在网页中嵌入office组件,显示office文件吗?不防看看上面的文章,用起来,还不错。
另:ASP.NET操作Word文档