ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Miscellaneous WINDEV functions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Opens a document in a new (non-modal) window using the WINDEV editor adapted to the document:
Remarks:
  • Two syntaxes are available:
    • blocking document opening: the application is blocked until the window displaying the document is closed.
    • asynchronous document opening: 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.
Example
sDocument is string
sDocument = fSelect("C:\Répertoires", "Fichier.docx", "Sélectionner un fichier", ...
       "Fichier Word (*.docx)" + TAB + ".docx" + CR + "Tableur (*.xlsx)" + TAB + ".xlsx")
IF OpenDocument(sDocument) = odFailure THEN
	Error("Impossible d'ouvrir le document.")
END
OpenDocument("Mon Document.docx", "Mon Document", odOptionNone, "", OuvreDocument_Callback)

INTERNAL PROCEDURE OuvreDocument_Callback(DocRésultat, nCR)
	SWITCH nCR
		CASE odOpenModified
			Info("Le document " + DocRésultat + " a été modifié")
		CASE odOpenNotModified
			Info("Le document " + DocRésultat + " n'a pas été modifié")
		OTHER CASE
			Info("Le document " + DocRésultat + " n'a pas pu être ouvert")
	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:
odFailureThe document was not opened.
odOpenModifiedThe document was opened and modified.
odOpenNotModifiedThe 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, <Document> will contain the buffer or HFSQL memo item modified and saved when the document was edited.
  • a variable of type: If the function returns the odOpenModified constant, <Document> will contain the variable modified and saved when the document was edited.
<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:
odOptionHidePaneIf 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.
odOptionMaxWindowDocument opened in read/write in a maximized window.
odOptionNone
(default value)
Document opened in read/write in a non-maximized window.
odOptionReadOnlyDocument opened in read-only.
<Password>: Optional string or Secret string
  • Password to use if the file is protected,
  • Empty string ("") if the file is not password-protected.
New in version 2025
Secret strings: If you use the secret string vault, the type of secret string used for this parameter must be "ANSI or Unicode string".
To learn more about secret strings and how to use the vault, see Secret string vault.

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:
odFailureThe document was not opened.
odOpenNotModifiedThe 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, <Document> will contain the buffer or HFSQL memo item modified and saved when the document was edited.
  • a variable of type: If the function returns the odOpenModified constant, <Document> will contain the variable modified and saved when the document was edited.
<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:
odOptionHidePaneIf 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.
odOptionMaxWindowDocument opened in read/write in a maximized window.
odOptionNone
(default value)
Document opened in read/write in a non-maximized window.
odOptionReadOnlyDocument opened in read-only. This constant can be combined with the odOptionNone and odOptionMaxWindow constants.
<Password>: Character string or Secret string
  • Password to use if the file is protected,
  • Empty string ("") if the file is not password-protected.
New in version 2025
Secret strings: If you use the secret string vault, the type of secret string used for this parameter must be "ANSI or Unicode string".
To learn more about secret strings and how to use the vault, see Secret string vault.
<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
Component: wd300obj.dll
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/16/2025

Send a report | Local help