Forum


Replies: 6   Views: 2821
Set temp_path from code
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 29-10-2019 - 08:27

Hello,

There's no option to change it dynamically. We recommend you to add a custom INI for each environment. As an alternative approach, you can change PhpdocxUtilities.php, setting the static var as public:

public static $_phpdocxConfig;

So you can change it after CreateDocx using a new INI file:

$docx = new CreateDocx();

PhpdocxUtilities::$_phpdocxConfig = parse_ini_file('/customconfig/phpdocxconfig.ini', true);

$text = 'Lorem ipsum dolor sit amet.';
$paragraphOptions = array(
    'bold' => true,
    'font' => 'Arial'
);

$docx->addText($text, $paragraphOptions);

Or change the array attributes:

PhpdocxUtilities::$_phpdocxConfig['settings']['temp_path'] = 'new value';

We move the request to the dev team to add support to change all options dynamically in the next release of phpdocx.

Regards.