OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

[SOLVED] How to know when a document is done loading?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
lknoll
General User
General User


Joined: 19 Oct 2011
Posts: 32
Location: Harrisburg, Pa

PostPosted: Fri May 11, 2012 12:21 pm    Post subject: [SOLVED] How to know when a document is done loading? Reply with quote

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
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Thu May 17, 2012 8:14 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Thu May 17, 2012 8:32 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address
lknoll
General User
General User


Joined: 19 Oct 2011
Posts: 32
Location: Harrisburg, Pa

PostPosted: Thu May 24, 2012 5:11 am    Post subject: Reply with quote

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
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Thu May 24, 2012 5:01 pm    Post subject: Reply with quote

Glad that it worked! Smile
_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group