Jump to content

Resetting the sheet position using OOoCalc.au3


Go to solution Solved by donnyh13,

Recommended Posts

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 -->

Actual.JPG

 

Desired -->

Desired.JPG

Edited by g0gcd
Labelling images
Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Solution
Posted (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 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

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...