日期:2014-05-17 浏览次数:20860 次
1.1.6 设置和创建书签,此功能比较强大,设置书签数据、添加书签和添加红头文件 SetFieldValue(BSTR strFieldName, BSTR strValue, BSTR strCmdOrSheetName) strFieldName:书签名 strValue:要设置的值 strCmdOrSheetName: 命令 ::ADDMARK:: 添加BookMark ::DELMARK:: 删除这个BookMark ::GETMARK:: 定位到这个BookMark ::FILE:: 插入的是文件 ::JPG:: 插入的是图片 一般来说: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" 这样,红头就自动插进去了 document.all.FramerControl1.SetFieldValue("hongtou","http://222.222.222.222/hongtou1.doc","::FILE::");
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="word_report.aspx.cs" Inherits="setreport_word_report" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script language="javascript" type="text/javascript"> function show_word() { document.all.officeframe.CreateNew("http://localhost:88/setreport/cgddxx.doc"); } function bookmark() { document.all.officeframe.SetFieldValue('time', 'cg1201001'); } </script> </head> <body onload="show_word();"> <form id="form1" runat="server"> <div> <object classid="clsid:00460182-9E5E-11d5-B7C8-B8269041DD57" id="officeframe" width="100%" height="500px" > <param name="_ExtentX" value="6350"/> <param name="_ExtentY" value="6350"/> <param name="BorderColor" value="-2147483632"/> <param name="BackColor" value="-2147483643"/> <param name="ForeColor" value="-2147483640"/> <param name="TitlebarColor" value="-2147483635"/> <param name="TitlebarTextColor" value="-2147483634"/> <param name="BorderStyle" value="1"/> <param name="Titlebar" value="0"/> <param name="Toolbars" value="1"/> <param name="Menubar" value="1"/> </object> <br /><a id="abc1" onclick="bookmark()" href="javascript:bookmark()">setsomething</a> </div> </form> </body> </html>