Create an ODT or ODS document template: Difference between revisions

Jump to navigation Jump to search
Line 113: Line 113:
</pre>
</pre>
This an example of what you may have in your office suite:
This an example of what you may have in your office suite:
[[File:Line for document generation.png]]
[[File:Line for document generation.png|500px]]
 
=== Other personalized tags ===
If you want to add a field that is not predefined, this is a solution:
* Add a file into htdocs/includes/modules/substitutions/functions_mymodule.lib.php
* Inside this file, just write one function like this:
<source lang="php">
/** Function called to complete substitution array (before generating on ODT, or a personalized email)
* functions xxx_completesubstitutionarray are called by make_substitutions() if file
* is inside directory htdocs/includes/modules/substitutions
*
* @param array $substitutionarray Array with substitution key=>val
* @param Translate $langs Output langs
* @param Object $object Object to use to get values
* @return void The entry parameter $substitutionarray is modified
*/
function mymodule_completesubstitutionarray(&$substitutionarray,$langs,$object)
{
  global $conf,$db;
 
  $myvalue='Put here calculated value to insert';
  $substitutionarray['myowntag']=$myvalue;
}
</source>


== Store your document ==
== Store your document ==
To have your document to appear in list of available documents, put it into correct subdirectory found into
To have your document to appear in list of available documents, put it into correct subdirectory found into
directory '''documents/doctemplates'''
directory '''documents/doctemplates'''

Navigation menu