Call this function when you close the page, close the file
function Window_onunload () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.close ();
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
New Document
//
function Newdoc () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
var doctype=document.getelementbyidx_x ("doctype"). Value;
Webobj.loadoriginalfile ("", doctype);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Show Print dialog box
//
////////////////////////////////////////////////////////////////////////////////////////////////////////
function ShowPrintDialog () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.printdoc (1);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Direct printing
//
function Zhiprint () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.printdoc (0);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Call this function when you close the page, close the file
//
function Window_onunload () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.close ();
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Unblock document Protection
//
function Unprotect () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.protectdoc (0,1, document.all.docPwd.value);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Set up document protection
//
function Protectfull () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.protectdoc (Document.all.docPwd.value);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Prohibit printing
//
function Notprint () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.setsecurity (0x01);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Recovery allows printing
//
/
function Okprint () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.setsecurity (0x01 + 0x8000);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Prohibit save
//
function Notsave () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.setsecurity (0x02);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Restore allows saving
//
/
function Oksave () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.setsecurity (0x02 + 0x8000);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Prohibit copying
//
/
function Notcopy () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.setsecurity (0x04);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Recovery allows replication
//
/
function Okcopy () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.setsecurity (0x04 + 0x8000);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Prohibit dragging
//
/
function Notdrag () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.setsecurity (0x08);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Resume dragging
//
/
function Okdrag () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.setsecurity (0x08 + 0x8000);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Revision document
//
/
function Protectrevision () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.settrackrevisions (1)
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Hide Revisions
//
/
function Unshowrevisions () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.showrevisions (0);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Show Current Revisions
//
/
function ShowRevisions () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.showrevisions (1);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Exit revision Status
//
/
function Exitrevisions () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.settrackrevisions (0);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Accept all current Revisions
//
/
function AcceptAllRevisions () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Document.all.WebOffice1.SetTrackRevisions (4);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Reject All current revisions
//
/
function Unacceptallrevisions () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
var vcount = Webobj.getrevcount ();
var strUserName;
for (Var i=1;i<=vcount;i++) {
Strusername=webobj.getrevinfo (i,0);
Document.all.WebOffice1.AcceptRevision (strUserName, 1)
}
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Get information about revisions
//
/
function Getrevallinfo () {
var Vcount;
Vcount = Document.all.WebOffice1.GetRevCount ();
var vopt = 0;
var vdate;
for (var i=1; i<= Vcount; i++) {
vopt = Document.all.WebOffice1.GetRevInfo (i,2);
if ("1" = = vopt) {
vopt = "Insert";
}else if ("2" = = vopt) {
vopt = "Delete";
}else{
Vopt = "Unknown operation";
}
Vdate = new String (Document.all.WebOffice1.GetRevInfo (i,1));
Vdate = parsefloat (vdate);
Dateobj = new Date (vdate);
Alert (dateobj.getyear () + "year" + dateobj.getmonth () + 1 + "month" + dateobj.getdate () + "Day" + dateobj.gethours () + "time" + Dateo Bj.getminutes () + "min" + dateobj.getseconds () + "SEC");
Alert ("User:" +document.all.weboffice1.getrevinfo (i,0) + "\ r \ n:" + vopt + "\ r \ n Content:" + Document.all.WebOffice1.GetRevInfo (i,3));
}
}
//
Set the current operation user
//
/
function Setusername () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
if (Document.all.UserName.value = = "") {
Alert ("User name cannot be empty")
Document.all.UserName.focus ();
return false;
}
Webobj.setcurrusername (Document.all.UserName.value);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Set bookmarks
//
/
function Addbookmark () {
Alert ("Add a bookmark named Test to the cursor");
Document.all.WebOffice1.SetFieldValue ("Test", "Add Bookmark Test", ":: Addmark::");
}
function Taohong () {
Alert ("Add set broken information to bookmark named test: Beijing Dot Poly Information Technology Co., Ltd.");
Document.all.WebOffice1.SetFieldValue ("Test", "Beijing Point Poly Information Technology Co., Ltd.", "");
}
//
Fill Template
//
/
function Fillbookmarks () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.bookmarkopt ("/template/fillbookmarks.jsp", 2);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Hide office2003 File menu
//
/
function Hidefilemenu () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.settoolbarbutton2 ("Menu Bar", 1,0);
}catch (e) {
Alert ("Exception \r\nerror:" +e+ "\r\nerror Code:" +e.number+ "\r\nerror Des:" +e.description);
}
}
//
Show office2003 File menu
//
/
function Showfilemenu () {
try{
var webobj=document.getelementbyidx_x ("WebOffice1");
Webobj.settoolbarbutton2 ("Menu Bar", 1,4);
}catch (e) {
alert ("exception