Opens the specified document.
Is a variable based on one of the following data types: ExcelDocument, WordDocument , File , XMLReader , XMLWriter , Window.
Is the path and name of the document. If only the name is specified, the document will be created in the default directory (DataXXX model directory).
- For ExcelDocument and WordDocument data types, a Numeric type is returned. So, it is possible to call it as a function:
&ErrorCode = &DataType.Open(…)
- When it is applied to the ExcelDocument data type, one of the following values is returned:
0 - OK
4 - Invalid template
10 - Could not open file
- When it is applied to the WordDocument data type, one of the following values is returned:
0 - OK
6 - Could not open file
10 - Could not complete operation
- For XMLWriter, XMLReader and File data types, no value is returned. So, for these data types the only way to know if the method has run successfully or not is by evaluating the ErrCode Property and the ErrDescription Property like the following code shows as a basic example:
msg(&File.ErrDescription) //or other action
These properties are valid for all the data types for which the Open method applies except for the Window data type.
- For the Window data type, either the method does not return a value nor the properties are valid.
This method opens the path specified in the parameter (FileName).
If the path corresponds to an Excel document or Word document:
Extended Data Types: ExcelDocument
- If the specified document does not exist, it is created by using the template specified in the Template property.
- When you open a document with the Open method, it is not displayed on the screen. To show it, you must use the Show Method.
- If you need to know if the spreadsheet already exists you can use file.exists().
.NET, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)
Complete list of error Codes and Messages returned by all the methods for ExcelDocument data type
Complete list of error Codes and Messages returned by all the methods for WordDocument data type