Hi Paolo, I played a bit around with your code and found following:
You can hand an array of TextRanges to .select() So the code oCurrCon = ThisComponent.CurrentController oSelect() = ThisComponent.getCurrentController().getSelection() oSelect().getByIndex(1).setString("ciao") oCurrCon.select(oSelect()) Does nearly what you want, but has still some problems. The changed TextRange will not be "visibly" selected in this multiple selection but will do so in a single selection oCurrCon.select(oSelect().getByIndex(1)) All other - unchanged - elements of the array will. Somehow the TextRanges in the array seem to be not updated properly. Also, if you let the Controller visibly select a single TextRange first, you can change visible selection to another TextRange but also can't create a visible multiple selection afterwards through CurrentController.select(...). If this is no bug, I find it not very reasonable at least. Maybe I'll find a workaround later. Hope that helps a little bit, Christoph Paolo Mantovani wrote: > Hi all, > > sorry for the dumb question, but I'm not able to figure this out.. > > I've a macro that modify the selected text (in writer) > example: > > txtrange = ThisComponent.CurrentSelection(0) > txtrange.setString("ciao") > > At this point the selection is lost, but I can easily restore it in this way: > > ThisComponent.CurrentController.select(txtrange) > > The problem is with multiple selections: > Perhaps I'm missing something, but I couldn't find any way to perform a > multiple selection via API. > > Or perhaps does it exists another way to modify the selected text without to > lost the user selection? > > > Thank you for any help > Paolo M > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]