|
|
|
|
|
OpenDocument (Function) In french: OuvreDocument Opens a document in a new (modeless) window using the appropriate WINDEV editor (word processor, spreadsheet, PDF reader or image editor). Remarks: - Two syntaxes are available:
- open a document in blocking mode: the application is blocked until the window that displays the document is closed.
- open a document asynchronously: the application is not blocked when the document is opened. A WLanguage procedure is executed when the document is closed. This syntax requires the name of the WLanguage procedure to be executed.
- To open the document without blocking the application and without specifying a WLanguage procedure, use OpenDocumentAsynchronous.
sDocument is TO string sDocument = fSelect("C:\Directories", "File.docx", "Select a file", ...    "Word file (*.docx)" + TAB + ".docx" + CR + "Spreadsheet (*.xlsx)" + TAB + ".xlsx") IF OpenDocument(sDocument) = odFailure THEN Error("Unable to open the document.") END OpenDocument("MyDocument.docx", "My Document", odOptionNone, "", OpenDocument_Callback)  INTERNAL PROCÉDURE OpenDocument_Callback(DocResult, nCR) SWITCH nCR CASE odOpenModified Info(DocResult + " has been modified") CASE odOpenNotModified Info(DocResult + " has not been modified") OTHER CASE Info(DocResult + " could not be opened") END END Syntax
Opening a document (blocking mode) Hide the details
<Result> = OpenDocument(<Document> [, <Title> [, <Options> [, <Password>]]])
<Result>: Integer constant Status report of document opening:
| | odFailure | The document was not opened. | odOpenModified | The document was opened and modified. | odOpenNotModified | The document was opened but it was not modified. |
<Document>: Character string Document to open. Corresponds to:- the full or relative path of document file to open.
- a buffer or an HFSQL memo containing the document to open. If the function returns the odOpenModified constant, the <Document> parameter will contain the buffer or HFSQL memo modified and saved in the document edit.
- a variable of type Document, xlsDocument or Image. If the function returns the odOpenModified constant, the <Document> parameter will contain the variable modified and saved during the document edit.
<Title>: Optional character string Title of window opened to display the document. By default, this parameter corresponds to the title of current window. <Options>: Optional Integer constant (or combination of constants) Options for document opening:
| | odOptionHidePane | If the document is an image, it is displayed in the image editor and the right pane (that displays the color characteristics) is not displayed by default. | odOptionMaxWindow | Document opened in read/write in a maximized window. | odOptionNone (default value) | Document opened in read/write in a non-maximized window. | odOptionReadOnly | Document opened in read-only. |
<Password>: Optional character string - Password to use if the file is protected,
- Empty string ("") if the file is not password-protected.
Opening a document (asynchronously, non-blocking mode) Hide the details
<Result> = OpenDocument(<Document> , <Title> , <Options> , <Password> , <WLanguage procedure>)
<Result>: Integer constant Status report of document opening:
| | odFailure | The document was not opened. | odOpenNotModified | The document was opened but it was not modified. |
<Document>: Character string Document to open. Corresponds to:- the full or relative path of document file to open.
- a buffer or an HFSQL memo containing the document to open. If the function returns the odOpenModified constant, the <Document> parameter will contain the buffer or HFSQL memo modified and saved in the document edit.
- a variable of type Document, xlsDocument or Image. If the function returns the odOpenModified constant, the <Document> parameter will contain the variable modified and saved during the document edit.
<Title>: Character string Title of window opened to display the document. By default, this parameter corresponds to the title of current window. <Options>: Integer constant Options for document opening:
| | odOptionHidePane | If the document is an image, it is displayed in the image editor in read/write mode and the right pane (that displays the color characteristics) is not displayed by default. | odOptionMaxWindow | Document opened in read/write in a maximized window. | odOptionNone (default value) | Document opened in read/write in a non-maximized window. | odOptionReadOnly | Document opened in read-only. This constant can be combined with the odOptionNone and odOptionMaxWindow constants. |
<Password>: Character string - Password to use if the file is protected,
- Empty string ("") if the file is not password-protected.
<WLanguage procedure>: Name of the procedure or lambda procedure Name of the WLanguage procedure ("callback") called after the document editing window is closed. For more details on this procedure, see Parameters of the procedure used by OpenDocument. This WLanguage procedure can correspond to: - a name of a global procedure,
- a name of an internal procedure,
- a lambda procedure.
Business / UI classification: UI Code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|