How to update the displayed value after changing the cell value in a script? [closed]

asked 2013-11-09 18:02:43 +0200

H.B. gravatar image

updated 2015-08-28 14:06:26 +0200

Alex Kemp gravatar image

I have a script to increment cell values which correctly does as much, however the displayed value is not updated (it only displays correctly in the formula bar). Using Data -> Refresh Range updates the display but it is cumbersome and refreshes the data for the whole sheet which can take a while for large sheets and it replaces the current selection.

Ideally i would like to work the refresh logic into the script. How can i do that if at all?


The script currently looks like this:

importClass(Packages.com.sun.star.uno.UnoRuntime);
importClass(Packages.com.sun.star.table.XCell);
importClass(Packages.com.sun.star.frame.XModel);

var model = UnoRuntime.queryInterface(XModel, XSCRIPTCONTEXT.getInvocationContext());
var selection = model.getCurrentSelection();
var cell = UnoRuntime.queryInterface(XCell, selection);
cell.setValue(cell.getValue() + 1);

Edit: This only appears to be an issue in Windows, it updates instantly in Debian. (I cannot confirm if the versions were the same though.)

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2016-02-19 11:16:45.895470