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 can I re-index TextFrames?

 
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 Mar 09, 2012 12:43 pm    Post subject: [SOLVED] How can I re-index TextFrames? Reply with quote

is there a way to re-index text frames in a writer document?

for example, i start with 2 text frames in this order:
Frame 1
Frame 2

i insert a new text frame in between these frames, so it now the order looks like this:
Frame 1
Frame 3
Frame 2

when i view ThisComponent.TextFrames.ElementNames, i see this:
index 0 = Frame 1
index 1 = Frame 2
index 2 = Frame 3

if i close the document and re-open it, openoffice will re-index the frames correctly to look like this:
index 0 = Frame 1
index 1 = Frame 3
index 2 = Frame 2

is there anyway i can programmatically re-index the frames without closing the document?


Last edited by lknoll on Thu May 10, 2012 6:55 am; edited 1 time in total
Back to top
View user's profile Send private message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1414
Location: France

PostPosted: Sat Mar 10, 2012 12:33 am    Post subject: Reply with quote

Hi,
Don't use index to get a particular text frame. You should name each frame and get them with getByName() method. You can change the name of a text frame with its setName() method.
_________________
Bernard

OpenOffice.org 1.1.5 fr / OpenOffice.org 3.4.1 en-US + langpacks, MS-Windows XP Home SP3
This forum is unusable, use instead Apache OpenOffice forums
Back to top
View user's profile Send private message Visit poster's website
lknoll
General User
General User


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

PostPosted: Thu May 10, 2012 6:37 am    Post subject: solved Reply with quote

This worked out great. Thanks for the help.
Back to top
View user's profile Send private message
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