Char(10) in MS Word 2007 Doc from Template

Does text formatting such as char(10) work with MS Word 2007 Doc from Template? I have a text with several line breaks and it works fine in Appian but the output of the document has everything in one line. 

  Discussion posts and replies are publicly visible

Parents
  • char(10) does not work in Word, it will remove the new line.

    If you want to keep it, you need to replace char(10) with "<w:br />" (similarly on html you would do with <br>)

  • Except if you just insert "<w:br/>" directly into the text, you won't see a linebreak in Word, you'll see "<w:br/>" (though the < or > characters might cause Word to throw an error when opening the document).  The reason for this is that it would still be inside the <w:t> ... </w:t> tags, meaning Word tries to interpret it literally as text.

    The solution I've found for this is to insert </w:t>, then <w:br/>, then a new <w:t>.   I prefer to do this via a predefined expression rule instead of ad-hoc, to take the guesswork out of it.

    Here's mine, i.e. GLBL_insertWordDocxLineBreak()...

    a!localVariables(
      local!rows: if(
        rule!GLBL_isBlank(ri!num),
        1,
        if(ri!num < 1, 0, ri!num)
      ),
    
      "</w:t>"
      & concat(repeat(local!rows, "<w:br/>" & char(10)))
      & "<w:t>"
    )

    Note this rule allows adding multiple linebreaks if/when necessary via passing in a value for ri!num.

Reply
  • Except if you just insert "<w:br/>" directly into the text, you won't see a linebreak in Word, you'll see "<w:br/>" (though the < or > characters might cause Word to throw an error when opening the document).  The reason for this is that it would still be inside the <w:t> ... </w:t> tags, meaning Word tries to interpret it literally as text.

    The solution I've found for this is to insert </w:t>, then <w:br/>, then a new <w:t>.   I prefer to do this via a predefined expression rule instead of ad-hoc, to take the guesswork out of it.

    Here's mine, i.e. GLBL_insertWordDocxLineBreak()...

    a!localVariables(
      local!rows: if(
        rule!GLBL_isBlank(ri!num),
        1,
        if(ri!num < 1, 0, ri!num)
      ),
    
      "</w:t>"
      & concat(repeat(local!rows, "<w:br/>" & char(10)))
      & "<w:t>"
    )

    Note this rule allows adding multiple linebreaks if/when necessary via passing in a value for ri!num.

Children