Apache OpenOffice (AOO) Bugzilla – Issue 14354
insertString() does not select text in cells
Last modified: 2017-05-20 11:13:16 UTC
I chose high priority, for this is an absolutely essential interface that should work completely. After inserting a string into a cell text using insertString(aCursor, "some string", true) the inserted text is not selected by the cursor. Example, oText is a *spreadsheet cell text*, which can be retrieved in the helper below. Sub ManipulateText(oText as Variant) Dim clause1 as String, clause2 as String clause1 = "When Mr. Bilbo Baggins of Bag End announced that he would " + _ "shortly be celebrating his eleventy-first birthday," clause2 = " there was much talk and excitement in Hobbiton" oText.setString(clause1 + clause2) oCursor = oText.createTextCursor() oCursor.gotoStart(false) 'false: nicht markieren oCursor.goRight(len(clause1) - 1, false) 'ans Ende von clause1 oText.insertString(oCursor, _ " with a party of special magnificence", true) 'true: markieren '--------------------------------------------------------^^^^^ ' the above use of true has no effect, no selection is made oCursor.setPropertyValue("CharWeight", _ com.sun.star.awt.FontWeight.BOLD) '-------------------------------------------^^^^ hence bold is not applied End Sub Sub UseSpreadsheetDocument Dim noProps() oServiceManager = getProcessServiceManager() 'fest eingebaut oDesktop = oServiceManager.createInstance("com.sun.star.frame.Desktop") oDoc = oDesktop.loadComponentFromURL("private:factory/scalc", _ "_blank", 0, noProps()) oSheets = oDoc.getSheets() oSheet = oSheets.getByIndex(0) oCell = oSheet.getCellByPosition(0, 0) 'oCell.setPropertyValue("IsTextWrapped", true) ManipulateText(oCell) End Sub
Hi Joerg, please have a look at the code. Frank
Andreas, this one is for you, i think...
-> Jörg: No, that is (most probably) an API/implementation problem in calc. In general it's only a Basic problem if for example the API independend part of a Basic program does not run or if the API only fails if accessed from Basic.
The bAbsorb parameter of insertString doesn't control selecting the text. It selects if the new text replaces the content of the text range or is appended. The IDL documentation doesn't say anything specifically whether the new text is to be selected in the text range object. In a text document, it is selected. Christian, you added the CollapseToEnd call to SvxUnoTextBase::insertString, I guess for XML import. To have the same behavior as in Writer, we should see if this is still necessary.
will have a look at this
nothing for ms_interop., so no blocking of 21783
Reset assigne to the default "issues@openoffice.apache.org".