Ask Your Question

How to change a recurring index entry.

asked 2021-03-04 15:10:34 +0200

Giova gravatar image

updated 2021-03-05 11:27:54 +0200

ajlittoz gravatar image

I entered an incorrect index entry and would like to change it. Unfortunately, doing it normally takes a long time: there are hundreds of references. Is there a way to replace the text or delete it and do it all over again? Thank you.

I am attaching a simplified example image. Having to correct and modify the errors marked in this index, how can I proceed?


file exemple: C:\fakepath\esempio.odt

(formatting corrected by ajlittoz for inline display of image)

edit retag flag offensive close merge delete


This answer is "maybe". Give more details about your case: is the entry simply the same as the marked words in text or is the entry completely different from the words at this location? What is the approximate number of erroneous references ~100 or ~500? Compared to the total number of index entries ~200 to ~1000?

As usual, don't forget to mention OS name and LO version.

ajlittoz gravatar imageajlittoz ( 2021-03-04 16:25:46 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2021-03-05 11:58:03 +0200

ajlittoz gravatar image

updated 2021-03-05 15:58:38 +0200

After examination of your sample for the "Cambidge Univsty" case, this is what I suggest.

Apparently "Cambidge Univsty" was manually added at start of "Cambridge University" word sequence which was probably later indexed with application of Apply to all similar texts. You then have duplication of index entries: one "spot" with misspelling, one correct spanning the words.

I saved your sample as .fodt so that the XML is easily accessible. The "spot" indexes are encoded as XML element text :alphabetical-index-mark … />. The important fact to note here is the slash in />, meaning this XML element is "self-sufficient" and closed at its end.

"Range" index markers need an opening XML element and a closing one.

Considering these two remarks, it is then easy to design a regular expression to fix the faulty "erroneous" index entries (in fact to remove them because they are enclosed in another "range" markup.

The index key is recorded in the XML element as text:string-value="…".

With a text editor which supports regular expressions, such as KWrite on my Linux box (you didn't mention your OS but there are equivalent on every OS), I replaced a pattern with "nothing". The pattern is:

<[^<]+text:string-value="Cambidge Univsty"[^/]+/>

where [^<]+ means any sequence of characters different from < and [^/]+ any sequence of characters different from /.

You can adapt to remove other superfluous entries.

Where you have "simply" a misspelling, like "MIlano" for Milano", use the traditional replace command.

When done transforming the .fodt with the text editor, reopen it with Writer, update the index and save again as .odt.

To show the community your question has been answered, click the ✓ next to the correct answer, and "upvote" by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

(the edit only removed typos, adding nothing fundamental)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2021-03-04 15:10:34 +0200

Seen: 42 times

Last updated: Mar 05