Skip to content

Help wanted to create document using template. #1449

@theenescresta

Description

@theenescresta

I am using PHPword to generate the word documents. I want to generate multiple documents so that I want to use the template. I tried this code in the controller
$templateProcessor = new TemplateProcessor('resources/Sample_07_TemplateCloneRow.docx');
$templateProcessor->setValue('Name', 'John Doe');
$templateProcessor->setValue(array('City', 'Street'), array('Detroit', '12th Street'));
and following error is displayed:
copy(resources/Sample_07_TemplateCloneRow.docx): failed to open stream: No such file or directory

at :
// Template file cloning
if (false === copy($documentTemplate, $this->tempDocumentFilename)) {
throw new CopyFileException($documentTemplate, $this->tempDocumentFilename);
}

What is the default directory of Template Processor? or we have to give location manually. Please help!

  • PHP version:7.0 laravel 5.5
  • PHPWord version: 0.14

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions