GXDOCU class

class GXDOCU(handle=0)

GXDOCU class.

Class to work with documents

copy(doc_us)

Copy GXDOCU

Parameters:doc_us (GXDOCU) – Source GXDOCU

New in version 5.1.1.

License: Geosoft Open License

classmethod create()

Create a document onject

Returns:GXDOCU Object
Return type:GXDOCU

New in version 5.1.1.

License: Geosoft Open License

classmethod create_s(bf)

Create from a serialized source

Parameters:bf (GXBF) – GXBF from which to read GXDOCU
Returns:GXDOCU Object
Return type:GXDOCU

New in version 5.1.1.

License: Geosoft Open License

doc_name(name)

The document name.

Parameters:name (str_ref) – Buffer to fill with document name

New in version 5.1.1.

License: Geosoft Open License

file_name(name)

The original document file name.

Parameters:name (str_ref) – Buffer to fill with document file name

New in version 5.1.1.

License: Geosoft Open License

get_file(file)

Get the document and place in a file.

Parameters:file (str) – File to which to write document

New in version 5.1.1.

License: Geosoft Open License

get_file_meta(file)

Get the document and place in a file with metadata.

Parameters:file (str) – File to which to write document

New in version 5.1.8.

License: Geosoft Open License

Note: If this document is only a URL link, the URL link will be resolved and the document downloaded from the appropriate server using the protocol specified.

The document has metadata, and the native document does not support metadata, the metadata will be placed in an associated file “filename.extension.GeosoftMeta”

get_meta(meta)

Get the document’s meta

Parameters:meta (GXMETA) – GXMETA object to fill in with the document’s meta

New in version 5.1.1.

License: Geosoft Open License

have_meta()

Checks if a document has metadata.

Return type:bool

New in version 5.1.1.

License: Geosoft Open License

is_null()

Check if this is a null (undefined) instance

Returns:True if this is a null (undefined) instance, False otherwise.
Return type:bool
is_reference()

Is the document only a reference (a URL) ?

Returns:1 - Yes, 0 - No
Return type:int

New in version 5.1.6.

License: Geosoft Open License

classmethod null()

A null (undefined) instance of GXDOCU

Returns:A null GXDOCU
Return type:GXDOCU
open(mode)

Open a document in the document viewer

Parameters:mode (int) – DOCU_OPEN constants

New in version 5.1.1.

License: Geosoft Open License

Note: On Windows, the default application for the file extension is used to open the file.

serial(bf)

Serialize GXDOCU

Parameters:bf (GXBF) – GXBF in which to write object

New in version 5.1.1.

License: Geosoft Open License

set_file(type, name, file)

Set the document from a file source.

Parameters:
  • type (str) – Document type
  • name (str) – Document name, if “” file name will be used
  • file (str) – Document file, must exist

New in version 5.1.1.

License: Geosoft Open License

Note: Document types are normally identified by their extension. If you leave the document type blank, the extension of the document file will be used as the document type.

To resolve conflicting types, you can define your own unique type by entering your own type “extension” string.

The following types are pre-defined (as are any normal Geosoft file types):

“htm” HTML “html” HTML “txt” ASCII text file “doc” Word for Windows document “pdf” Adobe PDF “map” Geosoft map file “mmap” Mapinfo map file (real extension “map”) “grd” Geosoft grid file “gdb” Geosoft database

URL Document Links

The document name can be a URL link to the document using one of the supported protocols. The following protocols are supported:

http://www.mywebserver.com/MyFile.doc - GXHTTP dap://my.dap.server.com/dcs?DatasetName?MyFile.doc - DAP (DAP Document Access) ftp://my.ftp.server.com/Dir1/MyFile.doc - FTP protocol

The full file name will be stored but no data will be stored with the GXDOCU class and the document can be retrieved using the sGetFile_DOCU method.

set_file_meta(type, name, file)

Set the document from a file source with metadata.

Parameters:
  • type (str) – Document type extension
  • name (str) – Document name, if NULL use file name
  • file (str) – Document file or URL

New in version 5.1.8.

License: Geosoft Open License

Note: See set_file. This function is the same as sSetFile_DOCU, plus insures that a GXMETA exists that includes the “Data” class. If the file has associated metadata, either supported natively in the file, or through an associated file “filename.extension.GeosoftMeta”, that metadata will be loaded into the GXDOCU meta, and a Data class will be constructed if one does not exist.

Also, the Document type Extension is very important in that it specifies the document types that natively have metadata. The ones currently supported are:

“map” Geosoft map file “gdb” Geosoft database “grd” Geosoft grid file
set_meta(meta)

Set the document’s meta

Parameters:meta (GXMETA) – GXMETA to add to the document’s meta

New in version 5.1.1.

License: Geosoft Open License

DOCU_OPEN constants

How to open document

DOCU_OPEN_VIEW

View

gxapi.DOCU_OPEN_VIEW = 0
DOCU_OPEN_EDIT

Edit

gxapi.DOCU_OPEN_EDIT = 1