A user who could not post directly to the list because he was using his phone with a non-matching e-mail address asked me why I was using CurrentController. I think I better write the answer to the list so everyone can participate.
The macro is rather complex. The documents are invoices containing text table with a list of items and their prices. They are created by a third-party program. I supply a template and the program fills in the data from its database. Now, it can happen that the table with the items is longer than one page (even longer than two or three) pages. The macro will detect this and split the table at those places, adding a subtotal to the foot of each page and a carry over on the start of the next page. I plan to add this macro to the template so that it automatically executes when a PDF is generated. Example: The document I get looks like this (I hope the layout survives ;)): <----- snip -----> <----- snap -----> After the macro is done, the document looks like this: <----- snip -----> <----- snap -----> As you can see, it's pretty complex and due to the lack of documentation, the only way to achieve this result was to replicate the steps I would otherwise do manually. That means getting a view cursor (which is a part of the current controller). Then I use my view cursor to do the stuff. I put it in the last column of the first row. Then I go down cell by cell, summing up values on way. Until the page changes. Then I go back up, insert subtotal and carry over and finally split the table between them. If there is another way to do it without CurrentController, I have not found it. If it helps, I can post the macro but it's a bit lengthy... -- View this message in context: http://nabble.documentfoundation.org/Macro-from-command-line-ThisComponent-CurrentController-not-found-tp4074374p4074502.html Sent from the Users mailing list archive at Nabble.com. -- To unsubscribe e-mail to: [email protected] Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
