MS Office document generation
A typical way for generating MS Office documents is using MS Word macro features. The Terminus application provides document generation actions, which may work, however, only when the required document templates have been installed. Document templates are not part of the ODABA installation and might be modified or rewritten according to specific requirements.
Typically, MS Office document templates refer to an initial document, which provides style definitions and title page for the document to be generated. This might easily be replaced by a more appropriate one. Moreover, styles might be changed, but not the style names, which are referred to from within the macros. Available macros and its resources are described below.
In order to support scripting languages as MS VB Script, ODABA .Net libraries have to be extended by a wrapper library. The .Net project and other resources required for MS document generation are available at following locations:
- MS Word helper functions
http://www.odaba.com/content/downloads/demos/odabaWordHelper.zip
- Document template
http://www.odaba.com/content/downlads/demos/DocumentTemplates.zip)
Those are just demos for showing, how to get out some documents from an ODABA database. On the other hand, these demos are used by RUN for generating documentation from Terminus specifications. Usually, document templates are installed in the template directory (/usr/share/odaba/template under Linux and ...odaba/template under MS Windows).
Document templates are provided as .dot files for reference documentation (ReferenceDocu.dot), Terminology Model documentation (TerminologyModel.dot) and hierarchical topic documentation (TopicsDocu.dot). Document style definitions are provided for these templates in .doc files with appropriate names.
MS Office document generation by means of VB Script macros is one possible way, but it is rather slow and difficult to maintain. A better way is using Open Document templates, which generate documents that are accessible in MS Office as well as in LibreOffice.
The MS Developer Studio 2010 solution provides an ODABA wrapper supporting ODABA database access and a few MS Word function for opening and closing word documents. Before compiling the solution, references for odaba-net.dll and dotnet-connector.dll have to be updated.
The wrapper library works with all MS Office versions from office 1997-2003 upwards. It has not been tested with older versions.
When opening a document (ODocument::Open()), an ini-file is required, that contains document and template name. The ini-file is, usually, generated when calling MS Word macros from within Terminus. Otherwise, an ini-file has to be provided, which contains a path the document to be created (option name passed in docname) and a path for a template for initializing the document (option name passed in templatename).
Two more functions (ODocument::Find() and ODocument::ReplaceText()) are available for convenience.
The odabaDBInterface file provides the ODABA database access function wrapper for accessing the database (ODatabase), for property handle support (OProperty) and for value access (OValue).
The terminology model template provides a document template (TerminologyModel.dot) for generating an MS Word document for a terminology model defined in Terminus. (context menu for a terminology model in the Models tree Generate Documents/Generate Word). The action generates an ini-file and calls the word macro from the location as being defined in option Options.Documentation.HTWordTemplate.
One may also start the macro without running Terminus, but the ini-file has to be provided manually, in this case. An example for an ini-file is shown below (remove comments before running the ini-file).
Before running the template, one might update the initializing document TerminologyModel.doc in order to get a more appropriate document design. The document delivered is designed for generating ODABA documentation and includes specific title and RUN logo.
[SYSTEM]
DICTIONARY=odaba\ode.sys - ODABA system dictionry
[DOCU]
DICTIONARY=odaba\ode.sys - ODABA system dictionry
RESOURCES=odaba\ode.dev - ODABA resource database
DATABASE=sample.dev - my development database
ONLINE_VERSION=YES
ACCESS_MODE=Write
NET=YES
ODABA_ROOT=odaba
CTXI_DLL=AdkCtxi
TRACE=... logfile directory
DSC_Language=English
DOC_PATH=odaba\Projects\Sample\doc\TM.doc - final document location
DOC_TEMPLATE=odaba\template\TerminologyModel.doc - document initialization
START_TOPIC=TM - terminology model selected
The hierarchy topics template provides a document template (HierarchyTopicsDoc.dot) for generating an MS Word document for a topic hierarchy defined in Terminus. (context menu for a terminology model in the Themes tree Generate Documents/Generate Word). The action generates an ini-file and calls the word macro from the location as being defined in option Options.Documentation.HTWordTemplate.
One may also start the macro without running Terminus, but the ini-file has to be provided manually, in this case. An example for an ini-file is shown below (remove comments before running the ini-file).
Before running the template, one might update the initializing document HierarchyTopicsDoc.doc in order to get a more appropriate document design. The document delivered is designed for generating ODABA documentation and includes specific title and RUN logo.
[SYSTEM]
DICTIONARY=odaba\ode.sys - ODABA system dictionry
[DOCU]
DICTIONARY=odaba\ode.sys - ODABA system dictionry
RESOURCES=odaba\ode.dev - ODABA resource database
DATABASE=sample.dev - my development database
ONLINE_VERSION=YES
ACCESS_MODE=Write
NET=YES
ODABA_ROOT=odaba
CTXI_DLL=AdkCtxi
TRACE=... logfile directory
DSC_Language=English
DOC_PATH=odaba\Projects\Sample\doc\MainTopic.doc - final document location
DOC_TEMPLATE=odaba\tpl\HierarchyTopicsDoc.doc - document initialization
START_TOPIC=MainTopic - start topic in the topic tree