How to remove all superscript from a Writer document

I have a writer document that has over 150 superscripts in it. I want to remove then all.

How can I do this?

Thanks

Raymond

It all depends on how the document is formatted. I’ll assume for the rest of my answer it is an .odt document, not a .doc(x), though the brute force procedure is also applicable but the result is not guaranteed to be stable if you save in a non-native format.

Well-behaved document

By well-behaved document, I mean a document which is fully styled according to the “semantic philosophy” without any direct formatting. In this case, you should identify which character style is responsible for superscript. But, in semantic styling, all styles are related to some significance and superscript indeed translate some author’s significance.

But the way your question is asked, I supposed your document is not well-behaved

Brute force

If superscript results from direct formatting, use Edit>Find & Replace, pressing the Format… button.

But superscript doesn’t mean anything per se. You can have many different positions for superscript. So, you’ll have to take not of the superscript parameters first:

  1. select some superscript you want to remove
  2. Format>Character, Position tab
  3. take note of the settings

Copy these settings into the Format… dialog or check that the default is the same. OK then Find All. All occurrences are selected. You can apply a specific character style or No Character Style. You can also clear direct formatting but this will also clear any other formatting different from the base paragraph style like size, font face, weight, colour, …

EDIT
A more straightforward solution suggested by (@floris_v) @mikekaganski :

Instead of searching for specific superscript position, you can search for any superscript, i.e. it will find for any character which is not on the baseline (subscript and superscript altogether). You press Attributes… and then tick Position.

I found that searching for superscript text with the correct parameters gives a problem on my system, both in LibO 7.4.2.3 and Apache OpenOffice 4.11: it always messages that the search text wasn’t found.
failtofindsuperscript.odt (10,0 KB)
[EDIT] Found it: don’t tick Automatic in the Format - Character - Position tab.

@floris_v Could you attach a failing doc so that I can have a look?

EDIT:
After analysis of sample file, the first occurrence has not the same properties as the others. Therefore if Find&Replace is asked to find with the second occurrence settings, it will obviously not find the first one.

This is an excellent example of the risks with direct formatting: visually both superscripts look the same, the difference is sufficiently small so you don’t notice it visually but Find&Replace will.

I cant get what you have stated about to work.

It is an odt file on Linux Mint 6.4.7.2
The ODT file I am trying to remove all superscript

In the attachment, searching for attribute Position gives all superscript occurrences; finding all then clearing direct formatting makes them not superscript (or you might alternatively want to press Del after finding all).

2 Likes

@RaymondTheBrave
You’ll have a hard time editing your document: everything is direct formatting and even when you use some built-in styles, you manage to superimpose direct formatting. Even vertical spacing is done with empty paragraphs.

The worst of all is you handle your endnotes manually instead of relying on the built-in automatic feature. I suppose your question addresses these superscript note numbers. I don’t know what you want to do in the end but your goal is certainly not to remove the superscript attribute. It is probably to “link” the anchor (the number inside the text) to the note at the end of the document and perhaps to have automatic numbering so that adding or deleting a note renumbers all the others.

  • You have a mess between Default Paragraph Style (which should not be used to format text) and Text Body for your discourse (the “standard” style in Writer).
  • Absolutely no character style
  • A section TextSection which makes no sense
  • Spurious manual paragraph breaks which split sentences which should remain a single unit with a manual page break in the middle (are you trying to synchronise your text with page limits? Writer does this better then you). This creates here blank areas at bottom of pages because I have not the same fonts as yours.

Before you start damaging your document, I recommend you read the Writer Guide, notably the chapters about styles.

PS: if your intention is really to remove all note anchors, just press Del or Bksp after leaving the Find&Replace dialog once you’ve Find All’ed.

I tried to make a macro for it, before I saw the easy solution from @mikekaganski :-). But the macro is finished so I add it as interestingness.

You can try this macro with enumerations of text in document, testing the CharEscapement property for superscripts, and then it selects the found ones via the CharFlash property (I hope you didn’t use this property in document).
The reason for selecting with CharFlash is, there isn’t a possibility to create easily the multiselection by the macro.

Sub selectAllSuperscripts 'find and select all superscript characters
	dim oDoc as object, oText as object, oEnum as object, o as object, oEnum2 as object, o2 as object
	dim oDesc as object, oSel as object, SrchAttributes(0) as new com.sun.star.beans.PropertyValue, i&
	oDoc=ThisComponent

	rem enumerate the text and set CharFlash to found Superscripts
	oText=oDoc.Text 'all text in document
	oEnum=oText.createEnumeration
	do while oEnum.hasMoreElements
		o=oEnum.nextElement
		oEnum2=o.createEnumeration
		do while oEnum2.hasMoreElements
			o2=oEnum2.nextElement
			if o2.CharEscapement>0 then o2.CharFlash=true 'set CharFlash for Superscript finding
		loop
	loop
	
	rem find all characters with CharFlash and remove CharFlash property from ones
	oDesc=oDoc.CreateSearchDescriptor
	SrchAttributes(0).Name="CharFlash" : SrchAttributes(0).Value=true
	oDesc.SearchAttributes=SrchAttributes
	oSel=oDoc.findAll(oDesc)
	for i=0 to oSel.Count-1 'I used the loop because I don't know if the uno command exists to on/off CharFlash
		oSel(i).CharFlash=false
	next i
	
	rem select founded characters
	oDoc.currentController.select(oSel)
End Sub

I did not write this document.

Although we have the same first name Raymond. My last name is different.

I would have been a lot for consistent.

Thanks to everyone for trying to help.

I will edit the document manually.

Thanks
Raymond