Customizer's Guide > Working with ActiveX Controls > Running Arbortext Editor in an ActiveX Control > open Method
  
open Method
Opens a resource as a Arbortext Editor document and displays it in the ActiveX embedded Arbortext Editor window. This method first closes the current document (if any) and prompts the user to save it (if modified). Note that at the Save prompt, the user might Cancel the operation. In this case, the current document is left intact and this method returns an error.
If you do not want the user to see a Save prompt, then you can call the close method to close the current document explicitly before calling the open method. Note that you can suppress all informational windows during an open operation by specifying the 0x0020 value for the documentFlags parameter.
open(documentPath [, documentFlags [, windowFlags [, xuiPath]]] )
Parameters
StringdocumentPath
Represents the path to a document. This can be in any form that Arbortext Editor recognizes, such as with the edit ACL command or the Application.openDocument AOM method. For example:
c:\documents\guide.xml
http://server/documents/guide.xml
x-wc://file=84756484.xml
intdocumentFlags
[optional] Defaults to 0. A bitmask that specifies open options. Constructed by ORing the bits from the following enumeration:
OPEN_RDONLY = 0x0001
Open for read only and do not lock the underlying file. If this is not set, the underlying file will be locked if possible and the document will be read-only if no lock was acquired.
The “checked out” status of CMS Objects will not be affected.
OPEN_DOCRDWR = 0x0002
Open for writing and do not lock the underlying file. The document will be modifiable even though the underlying file is not locked.
If the document was already open in memory, this will additionally attempt to lock the underlying file.
The “checked out” status of CMS Objects will not be affected.
OPEN_NLOCK = 0x0004
Do not lock the underlying file. Overrides all other flags which might acquire a file lock. The resulting document will not be modifiable unless OPEN_DOCRDWR is also given.
The “checked out” status of CMS Objects will not be affected.
OPEN_CC = 0x0008
Perform a completeness check when reading the SGML file. This option is ignored for XML documents.
OPEN_NOCC = 0x0010
Suppress the completeness check when reading the SGML file. This option is ignored for XML documents. OPEN_NOCC is the default option for SGML documents saved by Arbortext Editor.
OPEN_NOMSGS = 0x0020
Do not display any parser error messages in a message window. Instead, suppress all warnings and errors.
OPEN_XML = 0x0100
Open the document as an XML document even if it does not start with the XML version processing instruction. If not specified, the document is loaded as an SGML document unless the document starts with the XML version header.
OPEN_NOSTYLE = 0x0200
Open the document without loading a style sheet.
OPEN_NODTPROMPT = 0x0400
Do not prompt the user if the document type associated with the document instance does not exist or is not compiled. Instead, fail the operation.
OPEN_RECTABLES = 0x4000
Cause the table editor to recognize tables immediately after opening the document. By default, table objects are not created until the document is displayed in a window.
OPEN_EDITINIT = 0x8000
Process initialization files immediately after opening the document. This includes sourcing the associated document type instance files ( instance.acl, instance.js, and instance.vbs) and the document command files (docname .acl, docname.js, and docname .vbs). By default, these files are not processed until the document is displayed in a window.
OPEN_NEW_DOC = 0x10000
Treat the document as if it were created using the New dialog box. In this case, the path name is set to null and the document name is of the form DocumentN.
OPEN_FREEFORM = 0x80000
Open the document in free form mode, ignoring the document type specified in the file.
intwindowFlags
[optional] Defaults to 0. A bitmask that specifies window options.
Constructed by ORing the bits from the following enumeration:
0x00001 - Supply vertical scrollbar (pane).
0x00002 - Supply menu bar. If this is set then the Menu toolbar button will be shown. If this is not set, the Menu toolbar button is not shown and there will be no way to bring up menus.
The menu bar is part of the Edit toolbar (Toolbar 1) — 0x00020. Toolbar 1 must be supplied to enable the display of the menu bar.
0x00004 - Supply command subwindow.
0x00008 -Supply message footer subwindow.
0x00020 -Supply the Edit toolbar (that is, Toolbar 1) (pane).
0x00080 - Supply horizontal scrollbar (pane).
0x00100 - Do edit command intializations, include reading the document type instance command files ( instance.acl and instance.js) and document command files (docname.acl and docname .js) if they exist, and calling the ACL editfilehook when a document is attached to the window. This bit applies only to edit class windows (pane).
0x01000 - Supply a table column width ruler (pane).
0x02000 - Supply a table row height ruler (pane).
0x04000 - Supply the Markup toolbar (that is, Toolbar 2).
0x08000 - Supply the Table toolbar (that is, Toolbar 3).
0x10000 - Supply the Application toolbar (that is, Toolbar 4).
If a menu bar is requested, it must be initialized using the menu_load or menu_add ACL commands before the window is first displayed.
If a message footer is created, error messages and output from the message ACL command are displayed in the left part of the footer if the message is short enough (otherwise a popup dialog box is used). Any messages directed to the message footer are considered transient and are erased on the next key or button event received in the window.
If this parameter is omitted or zero, it behaves as if the following value were given: 0x9F9FF. This corresponds to the internal ACL constants (h::winMaskMain | h::winMaskEditStyle) which are used to create default “edit” windows. Over time, these constant might change, so this ensures the latest defaults are used.
Regardless of the value given, the following bits will be forcibly set:0x80850. This ensures that some window properties are set that are absolutely required for the control to work properly.
To cause the document to be shown with an absolute minimum of window artifacts (toolbars, scroll bars, status bar, etc..), any non-empty subset of 0x80850 can be used. For example: 0x00040.
StringxuiPath
[optional] Defaults to an empty string. An optional parameter used to supply an alternative XUI file to define the toolbars used by the edit window. If xuiPath is not supplied (or empty), then Arbortext-path\lib\dialogs\editwindow.xml is used.
Returns
The ACL ID of the possibly new window that was loaded as a result of this call.
A value of –1 can be returned if no documentPath parameter was given.
Throws
A COM error will be returned to the caller for the following cases:
User canceled at the save prompt or at some prompt while opening the requested document. In this case, returns an HRESULT value of 0x800704C7 which enables the caller to distinguish this case from other types of failures.
This represents a FACILITY of FACILITY_WIN32 and a WIN32 error code of ERROR_CANCELLED.
Failed to open the requested resource. In this case. the HRESULT will be E_FAIL
The associated COM error message is dependent upon the actual failure opening the requested resource.