Skip to content

setMacroChars doesnt work properly #2794

Open
@DanCvejn

Description

@DanCvejn

Describe the problem

When you use setMacroChars funtion, it wont find any variables in word file or with xml tags so setValues after that wont work. I have tried to change constructor code a bit by adding option to set macroChars in inicialization. After that change it works how it should.

Part that I edited:

    /**
     * @since 0.12.0 Throws CreateTemporaryFileException and CopyFileException instead of Exception
     *
     * @param string $documentTemplate The fully qualified template filename
     * @param string $macroOpeningChars Custom macro opening characters
     * @param string $macroClosingChars Custom macro closing characters
     */
    public function __construct($documentTemplate, $macroOpeningChars = null, $macroClosingChars = null)
    {
        if ($macroOpeningChars) {
            self::$macroOpeningChars = $macroOpeningChars;
        }
        if ($macroClosingChars) {
            self::$macroClosingChars = $macroClosingChars;
        }

Describe the expected behavior

When I have changed it, I get all wanted variables it file.

Variable in my file:
Image

Before with setMacroChars:
Image

After the change (new TemplateProcessor($filePath, '$~')):
Image

Priority

  • I want to crowdfund the feature (with @algora-io) and fund a community developer.
  • I want to pay the feature and fund a maintainer for that. (Contact @Progi1984)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions