Bug 116676 - Function insertTextPortion() of XTextPortionAppend Interface doesn't work
Summary: Function insertTextPortion() of XTextPortionAppend Interface doesn't work
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Macro-UNOAPI
  Show dependency treegraph
Reported: 2018-03-28 09:16 UTC by Roland Baudin
Modified: 2022-07-13 03:12 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:

Simple document with a form that contains a rich text control (8.71 KB, application/vnd.oasis.opendocument.text)
2018-03-28 09:16 UTC, Roland Baudin
Simple document with a form that contains a rich text control plus macro (10.07 KB, application/vnd.oasis.opendocument.text)
2018-04-03 15:32 UTC, Buovjaga

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Baudin 2018-03-28 09:16:01 UTC
Created attachment 140932 [details]
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()
oCtrl.insertTextPortion("Insert", aStyleProps, oTextCursor) 

End Sub
Comment 1 Buovjaga 2018-04-03 15:32:46 UTC
Created attachment 141058 [details]
Simple document with a form that contains a rich text control plus macro
Comment 2 Buovjaga 2018-04-03 15:33:02 UTC

Arch Linux 64-bit
Build ID: 6acda2a36c9025e0d3fe94d6ca8788ab60c3203e
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on April 2nd 2018
Comment 3 QA Administrators 2019-04-04 03:04:13 UTC Comment hidden (obsolete)
Comment 4 himajin100000 2019-08-27 05:38:28 UTC Comment hidden (obsolete)
Comment 5 himajin100000 2019-08-27 05:39:03 UTC
oops, I mis-posted to the wrong bug report.
Comment 8 QA Administrators 2021-09-20 03:39:35 UTC
Dear Roland Baudin,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)

If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword

Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team