[Solved] How to simultaneously remove all hyperlinks?

Discuss the word processor
Post Reply
Electron
Posts: 8
Joined: Mon Sep 08, 2008 8:16 pm

[Solved] How to simultaneously remove all hyperlinks?

Post by Electron »

Is there a way to simultaneously remove/disable all hyperlinks in a document (remove them all at once) ?
Last edited by Hagar Delest on Thu Sep 11, 2008 11:45 am, edited 1 time in total.
Reason: tagged the thread as Solved.
OOo 2.4.X on Ms Windows XP
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: How to simultaneously remove all hyperlinks?

Post 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).
AOO4/LO5 • Linux • Fedora 23
Electron
Posts: 8
Joined: Mon Sep 08, 2008 8:16 pm

Re: How to simultaneously remove all hyperlinks?

Post 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.
OOo 2.4.X on Ms Windows XP
JohnV
Volunteer
Posts: 1585
Joined: Mon Oct 08, 2007 1:32 am
Location: Kentucky, USA

Re: How to simultaneously remove all hyperlinks?

Post 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
Last edited by JohnV on Thu Apr 28, 2011 9:45 pm, edited 1 time in total.
Electron
Posts: 8
Joined: Mon Sep 08, 2008 8:16 pm

Re: How to simultaneously remove all hyperlinks?

Post by Electron »

JohnV ---

Excellent!

Thanks.

Jack
OOo 2.4.X on Ms Windows XP
ysangkok
Posts: 2
Joined: Wed Apr 27, 2011 3:20 pm

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

Post 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.
OpenOffice 3.1.1 on Windows 7
Electron
Posts: 8
Joined: Mon Sep 08, 2008 8:16 pm

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

Post 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).
OOo 2.4.X on Ms Windows XP
JohnV
Volunteer
Posts: 1585
Joined: Mon Oct 08, 2007 1:32 am
Location: Kentucky, USA

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

Post 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 
bucknersc
Posts: 1
Joined: Fri Dec 28, 2012 5:11 am

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

Post 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.
OpenOffice 3.4.1
Windows 7 Home Premium 64-bit
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

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

Post by acknak »

Excellent!

Nice catch--and thanks for sharing the tip!
AOO4/LO5 • Linux • Fedora 23
Glenn108
Posts: 1
Joined: Thu Oct 10, 2013 5:24 pm

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

Post 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:
OpenOffice 3.3.0 on Windows
TheJanitor
Posts: 1
Joined: Mon Jun 30, 2014 6:39 pm

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

Post 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.)
Pat Babcock in SE MI USA
OpenOffice 4.01 (but I update regularly) on Windows 7 Professional
Post Reply