Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template example file #26

Closed
ccorliss opened this issue Jul 26, 2013 · 5 comments
Closed

Template example file #26

ccorliss opened this issue Jul 26, 2013 · 5 comments

Comments

@ccorliss
Copy link

Does anyone have a doc that could be used with this example?
https://github.com/PHPOffice/PHPWord/blob/develop/src/Examples/Template.php

$document = $PHPWord->loadTemplate('Template.docx');

cc @Progi1984

@ccorliss
Copy link
Author

@MarkBaker Any ideas on this? I'm trying to figure out how this library expects fields to be setup in the word template.

Thanks

@ghost
Copy link

ghost commented Nov 5, 2013

Hi, Curtis. I guess this fragment of source code answers the question.

if(substr($search, 0, 2) !== '${' && substr($search, -1) !== '}') {
  $search = '${'.$search.'}';
}

So, the followed statement from Template.php:

$document->setValue('Value1', 'Sun');

will actually search for the "${Value1}" (NOT "Value1") in the specified template file.

@Progi1984 Progi1984 modified the milestones: 0.7.2, 0.7.1 Mar 3, 2014
@ivanlanin
Copy link
Contributor

The template example has been provided by @jeroenmoors (#90) on the develop branch as sample/resources/Sample_07_TemplateCloneRow.docx. He even provided added feature to clone row.

@ivanlanin ivanlanin self-assigned this Mar 16, 2014
@ivanlanin
Copy link
Contributor

Hi @ccorliss. Have you got a chance to see the current version of the develop branch?

@ccorliss
Copy link
Author

I did - great example, thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants