PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
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.
  • Versions 27 and later
    To open the document without blocking the application and without specifying a WLanguage procedure, use OpenDocumentAsynchronous.
    New in version 27
    To open the document without blocking the application and without specifying a WLanguage procedure, use OpenDocumentAsynchronous.
    To open the document without blocking the application and without specifying a WLanguage procedure, use OpenDocumentAsynchronous.
Example
sDocument is a 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 :
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, 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
Options for document opening:
odOptionNone
(default value)
Document opened in read/write in a non-maximized window.
odOptionMaxWindowDocument opened in read/write in a maximized window.
odOptionReadOnlyDocument opened in read-only. This constant can be combined with the odOptionNone and odOptionMaxWindow constants.
If an image is opened with the odOptionReadOnly constant, all modification options will be accessible in the image editor and the user will be able to "Save as".
For all other types of documents, all modification options proposed by the document editor are not accessible.
<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 :
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, 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:
odOptionNone
(default value)
Document opened in read/write in a non-maximized window.
odOptionMaxWindowDocument opened in read/write in a maximized window.
odOptionReadOnlyDocument opened in read-only. This constant can be combined with the odOptionNone and odOptionMaxWindow constants.
If an image is opened with the odOptionReadOnly constant, all modification options will be accessible in the image editor and the user will be able to "Save as".
For all other types of documents, all modification options proposed by the document editor are not accessible.
<Password>: Character string
  • Password to use if the file is protected,
  • Empty string ("") if the file is not password-protected.
<WLanguage procedure>: Name of procedure or lambda procedure
Name of the WLangage 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: wd270obj.dll
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment