general concept for calc macros

ok,

i have my own fight with not! understanding the concept, structures, objects and methods used in calc basic.
maybee that’s my problem. but:

when searching the web up and down and again for help or sources of knowledge i found NONE! *** not one single! *** sample for the use of ‘XSheetFilterDescriptor’, ‘XSheetFilterDescriptor2’, ‘getfilterfields’, ‘getfilterfields2’, neither any explaining references.

They are only listed in some diagrams and in the API reference, commented as: ‘provides access to the collection of filter fields.’ … thanks for that help …

trial and error leads to ‘runtime error’ and funny numbers …

Think of someone who really wants to learn something … the above is ridiculous and frustrating.

This way LO is not! open for people who want to change something.

I found a sample for converting VBA to OOB on

to replace:

Range(Cells(CurrentRow, i), Cells(CurrentRow, i)).Value = “a”

the comment is:

The Cells command returns a specific cell based on a row and column. So, you need the current row. Here is some craziness to get the active cell:

and the code is:

Sub RetrieveTheActiveCell()
Dim oOldSelection 'The original selection of cell ranges
Dim oRanges 'A blank range created by the document
Dim oActiveCell 'The current active cell
Dim oConv 'The cell address conversion service
Dim oDoc
oDoc = ThisComponent

REM store the current selection
oOldSelection = oDoc.CurrentSelection

REM Create an empty SheetCellRanges service and then select it.
REM This leaves ONLY the active cell selected.
oRanges = oDoc.createInstance(“com.sun.star.sheet.SheetCellRanges”)
oDoc.CurrentController.Select(oRanges)

REM Get the active cell!
oActiveCell = oDoc.CurrentSelection

oConv = oDoc.createInstance(“com.sun.star.table.CellAddressConversion”)
oConv.Address = oActiveCell.getCellAddress
Print oConv.UserInterfaceRepresentation
print oConv.PersistentRepresentation

REM Restore the old selection, but lose the previously active cell
oDoc.CurrentController.Select(oOldSelection)
End Sub

again, for a newbie like me that’s ridiculous and frustrating.

ok, it meets my personal experience that programmers prefer ‘C’ over Pascal regardless it’s created to annoy colleagues, is unreadable and only helps to do things without knowing what one does, and to write demonstration programs which, to evaluate a 512 byte record, do 512 compares on the first byte of that record (c’t a long time ago, teaching ‘c for beginners’)

maybe there is? a reason to do and make things that complicated … it takes time and skills to learn … time and skills to type … produces as many more errors as the code ist longer … about 15 times? … taking about 15^2 times to debug … there must be a reason for that … but without explanation it’s hard to accept …

and how the hell shall people become convinced to use OO or LO when they pay with so much time and frustration …

is LO macro programming developed for psychic masochists?

and the ‘experts’ exhaust themselves in commenting ‘you must accept that OOB is something different’, ‘something better’, ‘you must understand that you don’t understand’, ‘read some books’, ‘that (what you are doing) is not the way’, ‘we understood!’, and end up not mentioning which book, which references, or proving their experience …

i’m near to state: ‘if you like keeping it your secret … just do …’

hope somebody can help …

basics:

  • i need not use two pages of cryptic code for things that can be done with one statement!

  • any coder / developer coming over with such constructs and methods should be responsible to provide two working! samples, one basic and simple, one complex with all options cleanly commented!

reg.

newbie-01

I read through this entire discussion but am not certain what you are trying to do. See guidelines for asking. Perhaps you simply want to know, “How do I get the current cell.” I need not use two pages of cryptic code for things that can be done with one statement! Makes sense, so why did you write a two-page long question when one sentence would have sufficed?

This may be a duplicate of Access current cell from macro in Calc (solved).