[Solved] How to simultaneously remove all hyperlinks?

Discuss the word processor

[Solved] How to simultaneously remove all hyperlinks?

Postby Electron » Tue Sep 09, 2008 4:34 am

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
Electron
 
Posts: 8
Joined: Mon Sep 08, 2008 8:16 pm

Re: How to simultaneously remove all hyperlinks?

Postby acknak » Tue Sep 09, 2008 5:05 pm

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).
AOO 4 • Linux • Fedora 17
User avatar
acknak
Moderator
 
Posts: 17403
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: How to simultaneously remove all hyperlinks?

Postby Electron » Tue Sep 09, 2008 5:39 pm

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
Electron
 
Posts: 8
Joined: Mon Sep 08, 2008 8:16 pm

Re: How to simultaneously remove all hyperlinks?

Postby JohnV » Wed Sep 10, 2008 5:42 pm

Try this macro on a backup copy.
 Edit: New and much better version of this macro.
viewtopic.php?f=21&t=40598 

Code: Select all   Expand viewCollapse view
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.
JohnV
Volunteer
 
Posts: 1509
Joined: Mon Oct 08, 2007 1:32 am
Location: Kentucky, USA

Re: How to simultaneously remove all hyperlinks?

Postby Electron » Wed Sep 10, 2008 10:28 pm

JohnV ---

Excellent!

Thanks.

Jack
OOo 2.4.X on Ms Windows XP
Electron
 
Posts: 8
Joined: Mon Sep 08, 2008 8:16 pm

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

Postby ysangkok » Wed Apr 27, 2011 3:23 pm

Doesn't work on OpenOffice 3.1.1.
Code: Select all   Expand viewCollapse view
BASIC Runtime Error

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

Property or method not found.
OpenOffice 3.1.1 on Windows 7
ysangkok
 
Posts: 2
Joined: Wed Apr 27, 2011 3:20 pm

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

Postby Electron » Wed Apr 27, 2011 8:59 pm

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
Electron
 
Posts: 8
Joined: Mon Sep 08, 2008 8:16 pm

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

Postby JohnV » Thu Apr 28, 2011 4:51 am

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.
viewtopic.php?f=21&t=40598 
JohnV
Volunteer
 
Posts: 1509
Joined: Mon Oct 08, 2007 1:32 am
Location: Kentucky, USA

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

Postby bucknersc » Fri Dec 28, 2012 5:19 am

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

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

Postby acknak » Fri Dec 28, 2012 4:51 pm

Excellent!

Nice catch--and thanks for sharing the tip!
AOO 4 • Linux • Fedora 17
User avatar
acknak
Moderator
 
Posts: 17403
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

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

Postby Glenn108 » Thu Oct 10, 2013 5:31 pm

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
Glenn108
 
Posts: 1
Joined: Thu Oct 10, 2013 5:24 pm


Return to Writer

Who is online

Users browsing this forum: No registered users and 17 guests