DIAdem Help

Command: OpenDocument

  • Updated2024-09-12
  • 3 minute(s) read

Display all  Hide all

Command: OpenDocument

Returns an object which provides methods and properties for reading or editing the metadata of a document.

Set ReturnValue = OpenDocument(DocumentFileName, [ReadOnly], [DocumentFileType])

Input Parameters

DocumentFileName Specifies the filename of the document.
[ReadOnly] Specifies whether DIAdem opens a document in read-only mode or with read and write rights. By default DIAdem opens a document with write and read rights.
[DocumentFileType] Specifies the file types of the document.

Return Parameters

ReturnValue Document <Data> object type return value.

Use the method Save for Document <Data> in order to save changes to the document.

The following example displays the names and values of the meta properties of a PNG document:

VBScriptPython

 

Dim oMyDocument, oMyProperty, sOut
Set oMyDocument = OpenDocument(ProgramDrv & "Manuals\DIAdem_GettingStarted.pdf", False, eDocumentTypeAuto)
If oMyDocument is Nothing Then
  Call MsgBox("Could not open the file.")
Else
  For each oMyProperty in oMyDocument.Properties
    sOut = sOut & "Name: " & oMyProperty.Name & ", Value: " & oMyProperty.Value  & VBCrLf
  Next
  Call MsgBox(sOut)
End If
Note  Do not use the OpenDocument command in TDM Server scripts, because other processes, such as the DataFinder, will not be able to access the opened files. Instead, set the meta properties in the document with the Properties for Export property, before you export the layout in XML format, as PDF-, JPEG-, PNG- or TIFF file.

Related Topics

Command: ExecuteExclusiveBegin | Command: ExecuteExclusiveEnd | Command: ExecuteExclusiveEndAll