title: Can't insert newline in msword form field using Powebuilder OLE
body: <p>I have an application written in Powerbuilder 11.5 that automatically fills in form fields of a Word document (MS Word 2003).</p>
  
  <p>The Word document is protected so only the form fields can be altered.</p>
  
  <p>In the code below you can see I use <code>char(10) + char(13)</code> to insert a newline, however in the saved document all I see is  2 little squares where the characters should be.<br />
  I've also tried using <code>"~r~n"</code>, this also just prints 2 squares.</p>
  
  <p>When I fill in the form manually I can insert newlines as much as I want.</p>
  
  <p>Is there anything else I can try? Or does anybody know of a different way to fill in word forms using Powerbuilder?</p>
  
  <pre><code>//1 Shipper
  ls_value = ids_form_info.object.shipper_name[1]
  
  if not isnull(ids_form_info.object.shipper_address2[1]) then
   ls_value += char(10) + char(13) + ids_form_info.object.shipper_address2[1]
  end if
  
  if not isnull(ids_form_info.object.shipper_address4[1]) then
   ls_value += char(10) + char(13) + ids_form_info.object.shipper_address4[1]
  end if
  
  if not isnull(ids_form_info.object.shipper_country[1]) then
   ls_value += char(10) + char(13) + ids_form_info.object.shipper_country[1]
  end if
  
  if lnv_word.f_inserttextatbookmark( 'shipper', ls_value ) = -1 then return -1
  </code></pre>
  
  <p>The f_inserttextatbookmark is as follows:</p>
  
  <pre><code>public function integer f_inserttextatbookmark (string as_bookmark, string as_text, string as_fontname, integer ai_fontsize);
  if isnull(as_text) then return 0
      iole_word = create OLEOBJECT
  
      iole_word.connectToNewobject( "word.application" )
  
      iole_word.Documents.open( &lt;string to word doc&gt; )
  
   iole_word.ActiveDocument.FormFields.Item(as_bookmark).Result = as_text
  
  return 1
  end function
  </code></pre>