Page 1 of 1

[Solved] How to simultaneously remove all hyperlinks?

Posted: Tue Sep 09, 2008 4:34 am
by Electron
Is there a way to simultaneously remove/disable all hyperlinks in a document (remove them all at once) ?

Re: How to simultaneously remove all hyperlinks?

Posted: Tue Sep 09, 2008 5:05 pm
by acknak
You can convert hyperlinks to plain text simply by removing their text formatting--yes, really. So, all you have to do is select the text for each link and remove the formatting (Format > Default Formatting).

The problem is, how to select all the links. Unfortunately, this isn't so easy.

You may be able to devise a regular expression that will do it, e.g. if all the links' text have some begins with "www." or ends with ".com", but it seems unlikely to be so simple.

It won't be all at once, but you can easily step through all the links using the Navigator (F5).

Re: How to simultaneously remove all hyperlinks?

Posted: Tue Sep 09, 2008 5:39 pm
by Electron
Yeah, I know I can do one at a time -- am looking at a 22-page document full of hyperlinks, with more of these documents to come. However, I have found a work-around: save the document to MS Word 97 -- that kills the hyperlinks.

Re: How to simultaneously remove all hyperlinks?

Posted: Wed Sep 10, 2008 5:42 pm
by JohnV
Try this macro on a backup copy.
 Edit: New and much better version of this macro.
http://user.services.openoffice.org/en/ ... 21&t=40598 

Code: Select all

Sub Main
oDoc = ThisComponent
enum1 = oDoc.Text.createEnumeration
While enum1.hasMoreElements
 thisPara = enum1.nextElement
 enum2 = thisPara.createEnumeration
 While enum2.hasMoreElements
  thisPortion = enum2.nextElement
  thisPortion.HyperlinkTarget = ""
  thisPortion.HyperLinkURL = ""
 Wend
Wend 
End Sub

Re: How to simultaneously remove all hyperlinks?

Posted: Wed Sep 10, 2008 10:28 pm
by Electron
JohnV ---

Excellent!

Thanks.

Jack

Re: [Solved] How to simultaneously remove all hyperlinks?

Posted: Wed Apr 27, 2011 3:23 pm
by ysangkok
Doesn't work on OpenOffice 3.1.1.

Code: Select all

BASIC Runtime Error

Error in this line: "enum2 = thisPara.createEnumeration"

Property or method not found.

Re: [Solved] How to simultaneously remove all hyperlinks?

Posted: Wed Apr 27, 2011 8:59 pm
by Electron
I am surprised that OO does not have a Remove Hyperlinks feature; MS Word has had that at least since Word 97 (Tools/Macro/Macros/REMOVEHYPERLINKS).

Re: [Solved] How to simultaneously remove all hyperlinks?

Posted: Thu Apr 28, 2011 4:51 am
by JohnV
ysangkok,

OK, I took a look and I'll bet your document contains a table. I just threw this macro together and didn't consider or, for that matter, even think about the existence of tables in the document.

If I get a chance I'll address that issue.
 Edit: New macro.
http://user.services.openoffice.org/en/ ... 21&t=40598 

Re: [Solved] How to simultaneously remove all hyperlinks?

Posted: Fri Dec 28, 2012 5:19 am
by bucknersc
While not simultaneously removing all the hyperlinks in a document, nevertheless there's a very easy, three-step way to accomplish this manually.
1. Select one of the items in the document that contains a hyperlink. Open the context menu and select "Remove Hyperlink."
2. Press CTRL+A to select the entire document.
3. Press CTRL+SHIFT+Y to "Repeat: Reset attributes"
Hope this helps someone in the future.

Re: [Solved] How to simultaneously remove all hyperlinks?

Posted: Fri Dec 28, 2012 4:51 pm
by acknak
Excellent!

Nice catch--and thanks for sharing the tip!

Re: [Solved] How to simultaneously remove all hyperlinks?

Posted: Thu Oct 10, 2013 5:31 pm
by Glenn108
My version OO 3.3.0 in Calc does not have (right click) context menu option of "remove hyperlink".
Nor is "remove hyperlink" in any of the Menu items. :(

My solution was to Save As CSV, then open/import the CSV.
Nice clean spreadsheet, ready for my formulas/formatting. :)
I'm sure if your's is a Doc you could save a plain text (*.txt) file and that would do the same thing.

This is a solution for 1 sheet at a time, which surly beats 1 items at a time (find & replace).

I found this post via search and didn't realize until after I posted it was for Writer. :oops:

Re: [Solved] How to simultaneously remove all hyperlinks?

Posted: Mon Jun 30, 2014 6:43 pm
by TheJanitor
My context menu doesn't have "Remove Hyperlink", either - but it does have "default formatting". I selected the entire column of hyperlinked text, right clicked, then selected "default formatting" from the context menu, and the hyperlinks were done away with...

(I know it's an old thread but this tip may help someone else who, like me, stumbled onto this thread looking for the same solution.)