Forum


Replies: 1   Views: 22
Replace variables in master slides

Posted by jason_dev  · 03-05-2024 - 12:21

Dear all, 
I have successfully tried a few things in the test version - including replacing variables on individual slides. 
I copied this from one of the examples.

However, it did not get this working on the master slides, but that would be essential for me. I haven't found anything in examples or documentation on how this works. 

Used code: 

$pptx->replaceVariableText(array(
    "NAME" => "Jason",
));

Am I doing something wrong here or have I missed something?
Or is it not possible with your tool?

Thanks in advance, regards. 

Posted by admin  · 06-05-2024 - 06:40

Hello,

The current stable release of phppptx only allows replacing variables in slides. If you add placeholders/textboxes to the layout (these are not regular contents but placeholder contents) they are removed when a new slide is added. phppptx removes text contents from the layout to work exactly as MS PowerPoint does.

The next stable release of phppptx  (there's no release date), will include new features including the following:

- New cleanLayoutParagraphContents option to don't clean paragraph contents from the layout when adding a new slide with addSlide.
- Added masterSlides as target in replaceVariableText.

Only users with a license and active LUS can access beta features. If you purchase a license we can send these updates with a sample. Before purchasing a license you can also send a PPTX sample to contact[at]phpdocx.com and we'll check it to make sure the replacements you want to make are possible.

Regards.