g0gcd Posted March 9 Share Posted March 9 (edited) Quick question... I'm using OOoCalc to manipulate an Excel .xls template (for free) and have cracked most of the challenges. One which stumps me is how to reset the spreadsheet 'cursor' back to cell A1 so that when it is opened, the spreadsheet content is visible. In Excel, any operation on A1 would restore this cursor but I can't find any OOoCalc() function which achieves this behaviour. Any pointers please? Thanks John Actual --> Desired --> Edited March 9 by g0gcd Labelling images Link to comment Share on other sites More sharing options...
g0gcd Posted March 9 Author Share Posted March 9 CRACKED IT! I noticed that the output sheet was always 'resting' on K281, which was curious as none of my update/delete operations were around this. I checked my template - which has far more data in it - and, yes, the cursor was sitting on K281. Setting my template to A1 before closing now ripples through - the output sheet also starts up on A1. Still slightly curious to see if there's any OpenCalc function that emulates a click on A1.. but clearly any operations on the Calc spreadsheet using the UDF do not change the selected cell. Excel VBA has a Cells("A1").Select comand to do just that. Anyway, thanks for acting as a sounding board and I hope that this tidbit might help someone else who's, like me, spent days trying to figure it out. John donnyh13 1 Link to comment Share on other sites More sharing options...
Solution donnyh13 Posted March 10 Solution Share Posted March 10 (edited) 23 hours ago, g0gcd said: emulates a click on A1. This will select Cell A1. $oDocument.CurrentController.Select($oDocument.CurrentController.getActiveSheet().getCellRangeByName("A1")) Or more simplified. Local $oSheet = $oDocument.CurrentController.getActiveSheet(); or $oDocument.Sheets.getByIndex(0), or $oDocument.Sheets.getByName("Sheet1") Local $oCell = $oSheet.getCellRangeByName("A1"); Or getCellRangeByName("A1:C3") $oDocument.CurrentController.Select($oCell) Edited March 10 by donnyh13 LibreOffice UDF ; Scite4AutoIt Spell-Checker Using LibreOffice Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions." Link to comment Share on other sites More sharing options...
g0gcd Posted March 23 Author Share Posted March 23 @donnyh13 Thank you! John donnyh13 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now