Documents methods

The Documents interface supports the following methods:

Add([boolUseDefaultTemplate=true])  
Returns  Document 
Description  Opens a new document and returns it. If boolUseDefaultTemplate is true, the document is created from the default template. If boolUseDefaultTemplate is false then the Choose DTD or Rules File dialog is displayed. 
Usage 
JScript  Documents.Add([boolUseDefaultTemplate=true]);  
VBScript  Documents.Add([boolUseDefaultTemplate=true]) 
Example 
// SoftQuad Script Language JSCRIPT:
var doc = Documents.Add();
 

Close 
Returns  No return value 
Description  Closes all open documents. 
Usage 
JScript  Documents.Close();  
VBScript  Documents.Close 

Item(variantIndex)  
Returns  Document 
Description  Returns the Document object representing the open document specified by variantIndex. Valid numerical indexes range from 1 to Documents.Count; string indexes should consist of the FullName property of the desired Document
Usage 
JScript  Documents.item(variantIndex);  
VBScript  Documents.item(variantIndex) 
Example 
// SoftQuad Script Language JSCRIPT:
// return the first document
var doc = Documents.item(1);  
// can access all methods/properties of the document
Application.Alert(doc.FullName);  
 

Open(strFileName, [intViewType=-1]) 
Returns  Document 
Description  Opens the file strFileName and returns the corresponding Document object. strFileName can be an absolute or relative path. If relative, it will be interpreted as relative to the last folder from which a file was opened from the HoTMetaL PRO user interface (that is, not from a script). If intViewType is specified, the document is opened in the corresponding view. The list of allowed values is the same as for Document.ViewType
Usage 
JScript  Documents.Open("strFileName");  
VBScript  Documents.Open("strFileName") 
Example 
// SoftQuad Script Language JSCRIPT:
// substitute a path and file name for "yourFile"
var doc = Documents.Open("yourFile");  
// can access all methods/properties of the document
Application.Alert(doc.FullName);  
 

OpenTemplate([strTemplateFileName]) 
Returns  Document 
Description  Opens a new document from the template strTemplateFileName and returns the corresponding Document object. If a template filename (which must be a full path) is not supplied, the tabbed New dialog appears. 
Usage 
JScript  Documents.OpenTemplate(["strTemplateFileName"]);  
VBScript  Documents.OpenTemplate(["strTemplateFileName"]) 
Example 
// SoftQuad Script Language JSCRIPT: 
var doc=Documents.OpenTemplate(Application.Path + "\\Templates\article.html");
 

Save 
Returns  No return value 
Description  Saves all open documents. 
Usage 
JScript  Documents.Save();  
VBScript  Documents.Save 


Right arrow
Next Topic
Left arrow
Previous Topic
Table of contents
Table of Contents

Copyright © SoftQuad Software Inc. 1999