[Libreoffice-bugs] [Bug 116676] New: Function insertTextPortion() of XTextPortionAppend Interface doesn't work

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Wed Mar 28 09:16:01 UTC 2018


https://bugs.documentfoundation.org/show_bug.cgi?id=116676

            Bug ID: 116676
           Summary: Function insertTextPortion() of XTextPortionAppend
                    Interface doesn't work
           Product: LibreOffice
           Version: 5.4.6.2 release
          Hardware: x86-64 (AMD64)
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: roland65 at free.fr

Created attachment 140932
  --> https://bugs.documentfoundation.org/attachment.cgi?id=140932&action=edit
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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20180328/8c666705/attachment.html>


More information about the Libreoffice-bugs mailing list