TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Converting <br> to <w:br/> or <text:line-break/> -- Yet again.

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: hemocyanin
Date: 2014-06-13
Time: 03:53

Converting <br> to <w:br/> or <text:line-break/> -- Yet again.

I know this question has been asked before, and I've looked at the following:

http://stackoverflow.com/questions/9315531/opentbs-convert-html-tags-to-ms-word-tags
http://www.tinybutstrong.com/forum.php?thr=2950
http://www.tinybutstrong.com/forum.php?thr=2885

and some others I'm not relocating easily at the moment, but I'm not getting it to work for myself.

I'm using the function from the stackoverflow link (except my tags are "<br>" -- I accounted for that in the function). 

dataField is text along the lines of "blah blah blah.<br><br>blah blah blah."

In my template I use this:
[onshow.dataField;onformat=f_html2docx]

But when I merge data, instead of actual line breaks I get the <w:br/> tags (or ODT style tags in that version).  I've tried in both Libre Office and MS Word (adjusting the function for Libre Office of course) and in both I get tags instead of line breaks.  Is there something I'm missing?  I would love for this solution to work for me -- I just am not sure what I'm doing wrong here.
By: Skrol29
Date: 2014-06-13
Time: 13:06

Re: Converting <br> to <w:br/> or <text:line-break/> -- Yet again.

try with "strconv=no" in the field:

[onshow.dataField;onformat=f_html2docx;strconv=no]
By: hemocyanin
Date: 2014-06-13
Time: 18:56

Re: Converting <br> to <w:br/> or <text:line-break/> -- Yet again.

Thank you -- does the trick!  I'm so pleased.