by Izertis

Create documents in docx, xlsx (MS Office Word and Excel), odt, ods (LibreOffice and OpenOffice) and pdf format without MS Office or others plugins installed from any module and subpanel using templates.

Includes a 30 day guarantee
Try it Now

By clicking you consent to share your profile with the developer

#398 - Can't use values in Header & Footer in the .docx

Closed General Question created by kir 10 years ago

Can't use passed values in Header and Footer of the template. - displays as text like "a_name[field_name]"

  1. dharma member avatar

    Izertis Provider

    10 years ago

    In the header and footer you can not use fields from the dataset of the document. You only can use global variables of Sugar, variables like [onshow.xxx]. For example, to show the global variable of Sugar "current_user", you can put the variable [onshow.current_user.full_name] (this is equivalent to $GLOBALS['current_user']->full_name value). Other example is [onshow.sugar_version]

    If you need a variable which is not a Sugar global variable, you can create an event into the calculated fields of your module like the next example:

    function BeforeMergeBlock() { $GLOBALS['TemplateCurrentUserName'] = $GLOBALS['current_user']->full_name; }

    With this code you can use the variable [onshow.TemplateCurrentUserName] variable into the header or the footer.

    We will review the documentation and update it with this information.

    • kir member avatar

      kir

      10 years ago

      Thanks for reply! I asked because i wanted to use Contract's number and published day in the header + internal Word's page numbering option. Will i be able to set these values to function BeforeMergeBlock( ) { } ? May be it will be useful to set array of the values from detailview by default to be able to use them in the Header & Footer...

  2. dharma member avatar

    Izertis Provider

    10 years ago

    Yes, you can set these values in BeforeMergeBlock event. Take a look to the "custom/modules/Opportunities/DHA_DocumentTemplatesCalculatedFields.php" file example to create custom calculated fields to modules, and how to use BeforeMergeBlock (take care of the file class name).

    "... May be it will be useful to set array of the values from detailview by default ... " Sorry, this cannot be added as new general feature because the component is used too from listview, where we have data from several records.

This case is public. Please leave out any sensitive information such as URLs, passwords, etc.
Saving Comment Saving Comment...
Rating
  • "The single biggest downfall of the community edition of SugarCRM or SuiteCRM is the lack of creating a report form a custom module for a single event...." - ian

    Read More Reviews