Hopefully this will make it back top the list,.... Good call responding to the list
I believe that you cannot have a view cursor unless you have a display. Some work was done to
improve things like maybe it will work if you load the document and then hide it.... But that is a
long shot. Off hand I don't think that you can understand much related to position such add page
number without a view. All of the other cursors so not provide this information.
After saying that... I expect that PDF export needs a way to understand page numbers and it sounds
like you can do that without a view... So perhaps I am mistaken. My best guess is that it only
matters of page numbers are displayed in the document and that uses field which should have a
display value stored but not updated without the view.
Not sure is this helps...
greyspammer <greyspammer@postino.ch> wrote:
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: users+unsubscribe@global.libreoffice.org
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
--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
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
Context
- Re: [libreoffice-users] Re: Macro from command line: ThisComponent.CurrentController not found · Andrew Pitonyak
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.