<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Function insertTextPortion() of XTextPortionAppend Interface doesn't work"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=116676">116676</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Function insertTextPortion() of XTextPortionAppend Interface doesn't work
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.4.6.2 release
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>BASIC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>roland65@free.fr
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="http://bugs.documentfoundation.org/attachment.cgi?id=140932" name="attach_140932" title="Simple document with a form that contains a rich text control">attachment 140932</a> <a href="http://bugs.documentfoundation.org/attachment.cgi?id=140932&action=edit" title="Simple document with a form that contains a rich text control">[details]</a></span>
Simple document with a form that contains a rich text control

The function insertTextPortion() of the XTextPortionAppend Interface doesn't
work.

I attached a simple document that contains a form with a rich text control.

The following macro should first insert the unformatted text "Text", then
append the formatted text "Append" (in Arial red) using apendTextPortion() and
at last insert at the beginning the text "Insert" (in Arial red) using
insertTextPortion().

While appendTextPortion() works as expected (text is appended with the right
format), insertTextPortion() does not work: simply, nothing happens when it is
called.

Here is the test macro:

Sub Test()

Dim oForm As Object, oCtrl as Object

' Get form and rich text control
oForm = thisComponent.DrawPage.Forms.getByName("Form1")
oCtrl = oForm.getByName("Text1")

' Append unformatted text => works
oCtrl.Text = "Text"

' Text properties
Dim aStyleProps(1) As New com.sun.star.beans.PropertyValue
aStyleProps(0).Name = "CharColor"
aStyleProps(0).Value = rgb( 255, 0, 0 )
aStyleProps(1).Name = "CharFontName"
aStyleProps(1).Value = "Arial"

' Append formatted text => works
oCtrl.appendTextPortion("Append", aStyleProps) 

' Insert formatted text at the start => does not work
Dim oTextCursor as Object
oTextCursor = oCtrl.createTextCursor()
oTextCursor.GotoStart(FALSE)
oCtrl.insertTextPortion("Insert", aStyleProps, oTextCursor) 

End Sub</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>