company logo

Call creating MS Office document

In order to call creating an MS Office document, MS Word has to be invoked. Since the technology for creating MS Office documents is based on MS Word macros, the template document has to be called and executed. Since this is a different process, an ini-file has to be created and passed to the MS Word template (macro).

All information requested is passed via an ini-file, which is usually hard-coded in the document template macro. The document template examples provided in the .tpl directory of the installation folder shows how to open a database by means of an ini-file.

bool MyGUIContext::fragment() {

  Property    ph = line().property(); // get property handle for currenly selected line

// IniFile is not an interface class, but

// there is an implementation in sos, which might be used as pattern

  fstream ini_file;

  ini_file.open ("test.ini", fstream::out | fstream::app);

  ini_file << "[SYSTEM]" << std::endl;

  ini_file << "DICTIONARY=" << Option("SYSDB").toString().data() << endl;

  ini_file << "[DOCU]" << std::endl;

  ini_file << "DICTIONARY=" << Option("SYSDB").toString().data() << endl;

  ini_file << "RESOURCES=" << Option("SYSDB").toString().data() << endl;

  ini_file << "DATABASE=" << Option("SYSDB").toString().data() << endl;

  ini_file << "ONLINE_VERSION=YES" << endl;

  ini_file << "ACCESS_MODE=Write" << endl;

  ini_file << "ODABA_ROOT=" << Option("ODABA_ROOT").toString().data() << endl;

  ini_file << "CTXI_DLL=AdkCtxi" << endl;

  ini_file << "DICTIONARY=" << Option("SYSDB").toString().data() << endl;

  ini_file << "DSC_Language=" << GetLanguage() endl;

  ini_file << "DOC_PATH=" << docpath.data();

  ini_file << "DOC_TEMPLATE=" << GetDocumentPath() << endl;

  ini_file << "START_TOPIC=" << GetTemplatePath() << endl;

  ini_file.close();

// depending on template reqirements additional optione might be set

  ExecuteShell("open",GetTemplatePath());

  

  return true;

}