Skip to content

setValue Multi-Line Value #268

Closed
@martindavis

Description

@martindavis

Thank you for the amazing library! This has made my life much easier!

I am using your library to automatically fill out a packing slip. In order to make it easier to maintain and change, I am loading a Word Document as a Template, and then using setValue() to update variables. The template I am using has a lot of formatting and I would really prefer to avoid doing it in code if at all possible. It would also make it practically impossible for non-coders to update the template.

The issue I'm having is that I need to insert a multi-line replacement in several places (address, order notes, etc). Are there any plans to implement this in the future? Or am I missing another way to solve this problem, such as XSLT?

I could extend the Template Class with a setValueForPartMulti() and if I understand Word's Format correctly, my xml would need to look like the following:

 <w:r>
  <w:t>Hello</w:t>
  <w:br/>
  <w:t>world</wt>
</w:r>

Could I simply have my custom function preg_replace('\r\n', '<w:br/>', $value)? Would any issues arise from doing this?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions