How to change hyperlinks

Użytkowanie edytora dokumentów
tapitap
Posty: 2
Rejestracja: śr wrz 13, 2017 7:48 pm

How to change hyperlinks

Post autor: tapitap »

I have a problem that I am not capable to solve. I have got in Writer document many hyperlinks addresses attached to different words and these addresses I need to change eg:

word 'see' with the link https//subdomain1.domain.com/1 and I need to change it to https://subdomain2.domain.com/1
word 'check' with the link https//subdomain1.domain.com/2 and I need to change it to https://subdomain2.domain.com/2
word 'instead' with the link https//subdomain1.domain.com/3 and I need to change it to https://subdomain2.domain.com/3
word 'information' with the link https//subdomain1.domain.com/4 and I need to change it to https://subdomain2.domain.com/4
.
.
.
and so on.

It I can't do that manually (by right clicking and editing hyperlinks) as there will be many documents and each has hundreds of links. So I think it can be done only with macros. Unfortunately my knowledge in this field almost equal to zero. I would be really grateful for help.
LibreOffice ver: 4.2.8.2
Awatar użytkownika
Jermor
Posty: 2254
Rejestracja: sob paź 12, 2013 11:09 am
Kontakt:

Re: How to change hyperlinks

Post autor: Jermor »

I suggest you give up writing macros and use the properties of the odt document.
It is a compressed set of files that make up the final document.
Do it on a copy.
First, we change the file name from name.odt to name.zip
Extract the content.xml file from this file
Open this file with Writer.
The links correspond to the following structure:

Kod: Zaznacz cały

<text:a xlink:type="simple" xlink:href="https//subdomain1.domain.com/1 " text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">word</text:a>
Perform the Find and Replace operation:
Find: href = "https://subdomain1.
Replace: href = "https://subdomain2.
Replace All
Save a file
Copy the file to the name.zip archive
Restore name.odt
 
That's all
AOO 4.1.15, LO 7.5.9 (x64) na Windows 10 64bit
Ważne!
Jeśli twój problem został rozwiązany, wróć do swojego pierwszego postu, przejdź do edycji i dopisz [SOLVED] w temacie.
Inni, którzy mają podobny problem, będą wiedzieli, że istnieje jego rozwiązanie.
tapitap
Posty: 2
Rejestracja: śr wrz 13, 2017 7:48 pm

Re: How to change hyperlinks

Post autor: tapitap »

This is the ingenious solution I dreamed of :) No macros :))
Just wonderful! Additionally I have learned thanks to you that odt file is a kind of compilation of other files. Had no idea about that.

Thank you very much.
LibreOffice ver: 4.2.8.2
ODPOWIEDZ