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

Macro request: remove all index entries?

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
nrubdarb
Power User
Power User


Joined: 03 Jan 2006
Posts: 52

PostPosted: Fri Apr 13, 2007 2:56 am    Post subject: Macro request: remove all index entries? Reply with quote

Hi Folks,

Not sure if there isn't a better forum for this, but after picking through some online macro resources I realized it would be about a year before I would be able to write a macro to do what I want.

And it's pretty simple: I need an "index entry terminator". Why? Because in OpenOffice you can only bulk create index entries (using a concordance file), you cannot delete them in bulk. This obviously leads pretty quickly to the situation where you need this functionality: ONE wrong concordance file, and you are screwed.

What the macro needs to do is very simple:

1. Start at the beginning of the document.
2. Find the next index entry.
3. Delete it.
4. Repeat from 1. until you are at EOF.

I can probably find a looping macro, but I have NOT found out the BASIC routine for identifying an index field.

I'll keep looking, but if anyone in the meantime finds this out and would like to post it, or indeed the full macro, that would be brilliant!

Cheers,


Ed
_________________
OOo usage is v.2.0, mostly Writer. At work I'm evaluating OOo as a solution for publishing product manuals. OS is Windows XP. At home I use OOo for all kinds of text processing. My partner will be writing her thesis using Writer. OS is Debian Linux
Back to top
View user's profile Send private message
gizmo
OOo Advocate
OOo Advocate


Joined: 13 Oct 2004
Posts: 248
Location: Everywhere

PostPosted: Fri Jan 04, 2008 7:13 am    Post subject: Reply with quote

Hi all,

I'm having exactly the same problem as nrubdarb. I'm willing to write a macro by my own (and share it here), but I need a few pointers as I've never written an OO macro before.

Is there a way to loop through all the index entries (as in: what object returns a list of all index entries)?

thanks for your help!

gizmo


Last edited by gizmo on Tue Sep 06, 2011 10:13 am; edited 4 times in total
Back to top
View user's profile Send private message Visit poster's website
gizmo
OOo Advocate
OOo Advocate


Joined: 13 Oct 2004
Posts: 248
Location: Everywhere

PostPosted: Fri Jan 04, 2008 7:53 am    Post subject: Reply with quote

alright, I found a workaround that does not require a macro. it's not as elegant, but what the heck.

I simply renamed to odt file to .zip, extracted it, opened content.xml in a text editor and used search and replace to replace the results of the following regex with nothing:

Code:
<text:alphabetical-index-mark text:string-value="[^"]*"/>


maybe this helps someone with the same problem.

best regards,
gizmo



Moderation probe1: 2 SPAM URLs removed


Last edited by gizmo on Fri May 13, 2011 11:24 pm; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
MJK
Newbie
Newbie


Joined: 03 Jul 2006
Posts: 3
Location: Dublin, Ireland

PostPosted: Tue Jul 28, 2009 12:42 pm    Post subject: Reply with quote

Apologies for being about 18 months late Wink

Mainly for lurkers who might hit the same wall... In OOo ver 3.?, seems the internal Index-Entries syntax is slightly extended. In some simple tests, it seems ALL of the following Regex Strings should be deleted:

Code:

</text:span><text:alphabetical-index-mark-start text:id="[^"]*"/><text:span text:style="[^"]*"/>
</text:span><text:alphabetical-index-mark-end text:id="[^"]*"/><text:span text:style="[^"]*"/>
<text:alphabetical-index-mark-start text:id="[^"]*"/>
<text:alphabetical-index-mark-end text:id="[^"]*"/>
<text:alphabetical-index-mark text:string-value="[^"]*"/>

All the expressions are similar, and, obviously, a single RegEx could be composed to handle all of them!

And be careful to replace the above matches with an EMPTY string - not with one-or-more blanks!

HTH!
- Mike (original post edited)
Back to top
View user's profile Send private message Visit poster's website
j.kornelsn
General User
General User


Joined: 28 Jan 2010
Posts: 10

PostPosted: Sun Aug 01, 2010 10:06 pm    Post subject: Re: Deleting all index entries Reply with quote

Another option to delete all entries is to go to Edit -> Index Entry and hold down Alt+D until it is finished. It takes only a second or two for each page, depending on how many entries there are.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    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