| View previous topic :: View next topic |
| Author |
Message |
lknoll General User

Joined: 19 Oct 2011 Posts: 32 Location: Harrisburg, Pa
|
Posted: Fri May 11, 2012 12:21 pm Post subject: [SOLVED] How to know when a document is done loading? |
|
|
I have a document that contains 29 pages. Approximately half the pages contain tables. When I open the document, the page number count in the bottom of the screen will start at 30 (then re-adjusts to 29), 29 (correct total), or a number less than 29 (then gradually work its way up to 29). The problem seems to be with OpenOffice applying style attributes to the tables, specifically "Allow table to split across pages and columns". Is there anyway to tell when this is completed? And the document display has completed loading?
I have tried:
1. The OnLoad events and they do not work. They fire off before the page numbering has completed.
2. The OnLayoutFinished event, and I am not sure what this was doing.
3. I have also tried sending the cursor to the end of the document and calculating this way. But when the document starts at 30 and the cursor goes to page 30, it will not re-adjust itself back to 29. Same thing happens when I use ThisComponent.getCurrentController.PageCount.
Thanks.
Last edited by lknoll on Thu May 24, 2012 5:11 am; edited 1 time in total |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Thu May 17, 2012 8:14 pm Post subject: |
|
|
I am replying primarily so that I can see responses to your question. This is not something that I had ever considered. If I wanted to experiment, I would probably tell the document to recalculate all fields and such in the document before obtaining the total page count. I will see if I can find an example of something similar.... _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Thu May 17, 2012 8:32 pm Post subject: |
|
|
I guess that I would first try something like this:
| Code: | | ThisComponent.TextFields.refresh() |
I might also record a macro to do Tools > Update > Update All. I did not test to see if this works or not:
| Code: | sub update_all
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:UpdateAll", "", 0, Array())
end sub |
_________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
lknoll General User

Joined: 19 Oct 2011 Posts: 32 Location: Harrisburg, Pa
|
Posted: Thu May 24, 2012 5:11 am Post subject: |
|
|
This did not work
| Code: | | ThisComponent.TextFields.refresh() |
but, the update_all sub does give me what I need. It forces the document to re-pagenate, so when that has completed the document is ready to go. I tried this on a 360 page document and surprisingly it does not take long to complete either.
Thanks for your help! |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
|
| Back to top |
|
 |
|