This project is read-only.

${my_footer_variable} in Docx Template

Dec 7, 2010 at 6:02 AM

is it possible to use ${my_footer_variable} in the footer part of the docx template?

Dec 7, 2010 at 3:27 PM

Yes, you can put a variable in the footer, but you must use the correct syntax.

variable syntax = $my_variable     ........  NOT ${my_variable}

footer autotext = {PAGE} 

A sample code snippet:

// report footer
$paraStyle = array('align' => 'center');
$testVariable = 'My Test Variable ';
$footer = $section->createFooter();

$footer->addPreserveText( $testVariable.'{ DATE \@"MMMM d, yyyy" } Page {PAGE} of {NUMPAGES}', null, $paraStyle );
//can't seem to insert other 'autotext' like {FILENAME} and {AUTHOR}

Results (centered in the footer):

My Test Variable December 7, 2010               Page 1 of 1

Apr 13, 2011 at 4:51 AM

See my comment regarding this here: