| View previous topic :: View next topic |
| Author |
Message |
nrubdarb Power User

Joined: 03 Jan 2006 Posts: 52
|
Posted: Fri Apr 13, 2007 2:56 am Post subject: Macro request: remove all index entries? |
|
|
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 |
|
 |
gizmo OOo Advocate


Joined: 13 Oct 2004 Posts: 248 Location: Everywhere
|
Posted: Fri Jan 04, 2008 7:13 am Post subject: |
|
|
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
Türen
sveriges billigaste via gra
[/b]
Last edited by gizmo on Tue Sep 06, 2011 10:13 am; edited 4 times in total |
|
| Back to top |
|
 |
gizmo OOo Advocate


Joined: 13 Oct 2004 Posts: 248 Location: Everywhere
|
Posted: Fri Jan 04, 2008 7:53 am Post subject: |
|
|
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 |
|
 |
MJK Newbie

Joined: 03 Jul 2006 Posts: 3 Location: Dublin, Ireland
|
Posted: Tue Jul 28, 2009 12:42 pm Post subject: |
|
|
Apologies for being about 18 months late
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 |
|
 |
j.kornelsn General User

Joined: 28 Jan 2010 Posts: 10
|
Posted: Sun Aug 01, 2010 10:06 pm Post subject: Re: Deleting all index entries |
|
|
| 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 |
|
 |
|