MS Word hyperlinks doesn't work in Pages
apple Verified ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hi!
I have a 200 pages large MS Word document with table content lists. The links doesn't work well in Pages so I would like to redo it to work in Pages. I think one problem is that there are one main Table Content List and one for each chapter. From what I could find out in the manual Pages can only have a main TBL or one for each chapter/section, right?
I would be nice to get workable links without rewriting the whole document. Any suggestions or tips???
I have posted in iWork 08 but I have also 09, do the work exactly in the same way?
10 replies
Sign in or join Beachball Help to reply.
- 0
Apple Support Community member ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
In Pages '09 as in Pages '08, we may have several TOC but they can't share pages.
The PDF User Guide states:
Each table of contents (TOC) you create using a Word Processing template lists only the content that follows it, up until the next table of contents. If you want a master table of contents for the entire document, it must be the only table of contents, and it must be at the beginning of the document.
Yvan KOENIG (from FRANCE dimanche 15 février 2009 18:11:26)
- 0
Apple Support Community member ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Yes, I have read that in the manual.
But how do I get rid of all (they are many) of those done in MS Word? If I click on a link I get an error message that the bookmark doesn't exist or it tries to open it in safari and can't find the TOC-522293835 (Pages09) or tries to open it in Safari (Pages08). I'd rather use the document in Pages than in MS Word. I need to make new bookmarks to make it work but first I have to get rid of the ones named TOC... - 0
Apple Support Community member ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hi fruhulda,
Welcome to Pages '08 discussions.It's my hope I understand your question if not I'm apologizing up front.
It sounds to me you want to turn off all links so they don't function. If so open Inspector > Link Inspector, at the bottom is a check box it reads Make all hyperlinks inactive. You'll notice at the top you can choose to make an individual hyperlink inactive as well.
Hope that is what you're seeking.
These Discussions are enduser helping enduser, not Apple employees answering questions. Apple provides these discussion forums for endusers however, Apple neither monitors nor engages in discussions. Enduser such as yourself when they have extra time answer questions.
Again, welcome to Pages '08 Discussions, have fun here.
Cordially,
RicD - 0
Apple Support Community member ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hi Ric!
Thanks for trying to understand me. I have tried your suggestions too. Deactivating doesn't help. I need to erase the book marks and doing it one by one will take ages as there are several hundreds. As they are named TOC and given a number I don't know where they link to (getting error message) so I can't re-link them to make them work.I hoped someone had had the same problem.
My own thoughts now is if I could erase them in MS Word? I haven't used MS Word for more than opening doc-files so there will be yet another learning curve to climb:) - 0
Apple Support Community member ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hi again! I have been looking around on the Internet and it seems that the PC-user also sometimes like to erase all the TOC-addresses/book marks. But they have the possibility to get programs doing that for them.
My solution turned out like this:
1. Opened the doc-file in Word X and saved it. I did this because the next step didn't work otherwise, due to the versions of my programs.
2. Opened the doc file in AppleWorks!!! having MacLinPlus. It seems that AW can't keep the TOC-addresses.
3. Saved the document again as a doc-file.
4. Opened it in Pages and I could start with creating a new Table of Contents and will also create new hyperlinks within the document.Message was edited by: fruhulda
- 0
Apple Support Community member ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hi fruhulda,
Ah, the ole-AppleWorks trick!Good call. Thank you for posting your steps I'm sure they will assist others in similar situations.
Cordially,
RicD
- 0
Apple Support Community member ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Here, quick and neat soluce:
--[SCRIPT]{code}
(*
Enregistrer le script en tant qu'Application ou Progiciel : remove links.app
Déposez le sur le bureau par exemple.
Glisser-déposer l'icône d'un document Pages sur celle du script
va éliminer tous les Hyperliens et signets présents dans le document.+++++++
Save the script as an Application or an Application Bundle: remove links.app
Store it on the desktop for instance.
Drag and drop the icon of a Pages document on the script's icon
to remove the Hyperlinks and Bookmarks embedded in the document.Yvan KOENIG (Vallauris, FRANCE)
16 février 2009
*)--=====
property removeBookmarks : true
(*
true = remove the bookmarks
false = don't remove the bookmarks *)
property removeLinks : true
(*
true = remove the Links
false = don't remove the Links *)
property liste : {}(* Here are the description of bookmarks an Hyperlinks in the index.xml file
/>use the <sf:bookmark sf:name="document" sf:ranged="true" sf:page="2">document</sf:bookmark>
ici un <sf:link href="#iWork%20MUST"><sf:span sf:style="SFWPCharacterStyle-7">hyperlien</sf:span></sf:link><sf:br *)
--=====
on open (sel)
set theDoc to (item 1 of sel) as text
tell application "System Events" to tell disk item theDoc
set nn to name
set uti to type identifier
set isPackage to package folder
end tellif nn is "index.xml" then
my traiteIndex(theDoc)
else if uti is not in {"com.apple.iwork.Pages.Pages", "com.apple.iwork.pages.sffpages"} then
error "Not a Pages document !"
else if isPackage then
-- here the document is a package
if theDoc ends with ":" then set theDoc to text 1 thru -2 of theDoc
tell application "Finder"
set the_index to (theDoc & ":index.xml")
set indexGzAvailable to exists file (the_index & ".gz")
set indexAvailable to exists file the_index
end tell
if indexGzAvailable then
if indexAvailable then tell application "Finder" to delete file the_index
my expandIndex(the_index & ".gz")
my traiteIndex(the_index)
else
if indexAvailable then
my traiteIndex(the_index)
else
error "No Index available !"
end if
end if -- indexGzAvailable
else
-- here the document is a flat one
tell application "Finder"
set cont to (container of file theDoc) as text
set name of file theDoc to (nn & ".zip")
end tell
set theDocZ to cont & nn & ".zip"
my expandDoc(theDocZ, theDoc)
tell application "Finder"
set name of file theDoc to (nn & "yk")
set theDocF to cont & nn & "yk"
set the_index to (theDocF & ":index.xml")
set indexAvailable to exists file the_index
end tell
if indexAvailable then
my traiteIndex(the_index)
end if
end if
end open--=====
on traiteIndex(theIndex)
my nettoie()
(* Lis le contenu du fichier Index.xml *)
set texte to read file theIndex from 1if removeBookmarks then
(* supprime les descripteurs de signets *)
set theKey1 to "<sf:bookmark sf:name"
set theKey2 to "</sf:bookmark>"
if texte contains theKey1 then
set my liste to my decoupe(texte, theKey1)
(* enlever jusqu'au premier quote &>
enlever la première occurence de theKey2 *)
repeat with i from 2 to count of my liste
set itm to my decoupe(item i of my liste, theKey2)
set itm1 to item 1 of itm
set itm1 to text (1 + (offset of ">" in itm1)) thru -1 of itm1
set itm2 to my recolle(items 2 thru -1 of itm, theKey2)
set item i of my liste to (itm1 & itm2)
end repeat -- i
set texte to my recolle(my liste, "")
end if
end if -- removeBookmarksif removeLinks then
(* supprime les descripteurs de liens *)
set theKey1 to "<sf:link href="
set theKey2 to "</sf:span></sf:link>"
if texte contains theKey1 then
set my liste to my decoupe(texte, theKey1)
(* enlever jusqu'à la 2ème occurence de quote & >
enlever la première occurence de theKey2 *)
repeat with i from 2 to count of my liste
set itm to my decoupe(item i of my liste, theKey2)
set itm1 to item 1 of itm
set itm1 to text (1 + (offset of ">" in itm1)) thru -1 of itm1
set itm1 to text (1 + (offset of ">" in itm1)) thru -1 of itm1
set itm2 to my recolle(items 2 thru -1 of itm, theKey2)
set item i of my liste to (itm1 & itm2)
end repeat -- i
set texte to my recolle(my liste, "")
end if
end if -- removeLinksset eof of file theIndex to 0
write texte to file theIndex
my nettoie()
end traiteIndex--=====
on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe--=====
on recolle(l, d)
local t
set AppleScript's text item delimiters to d
set t to l as text
set AppleScript's text item delimiters to ""
return t
end recolle--=====
on nettoie()
set liste to {}
end nettoie--=====
(* Expands the zip file z in the container d, z and d are pathnames as strings *)
on expandDoc(z, d)
do shell script "unzip " & quoted form of (POSIX path of (z)) & " -d " & quoted form of (POSIX path of (d))
end expandDoc--=====
on expandIndex(f)
do shell script "gunzip " & quoted form of (POSIX path of (f))
end expandIndex--=====
on lisIndex_xml(f)
local t
try
set t to ""
set t to (read file f)
end try
return t
end lisIndex_xml--=====
on compactIndex(nDoc)
local aliasNDoc
set aliasNDoc to nDoc as alias
write leTexte to aliasNDoc starting at 0
do shell script "gzip " & quoted form of POSIX path of aliasNDoc
end compactIndex--=====
--[/SCRIPT](code}Yvan KOENIG (from FRANCE lundi 16 février 2009 22:48:02)
- 0
Apple Support Community member ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
CAUTION:
test it on a copy of the Pages document.I forgot that you are using Pages '08.
The script was tested with Pages '09.
Maybe the link/bookmark descriptors are different.Yvan KOENIG (from FRANCE lundi 16 février 2009 22:52:29)
- 0
Apple Support Community member ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Wow, Yvan! You have put a lot of work in to the script!
- 0
Apple Support Community member ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Here is an enhanced version.
(1) I used it with Pages '08 documents
(2) I discovered a bug in the "save as Pages '08" feature.
{code}
(*Enregistrer le script en tant qu'Application ou Progiciel : remove links.app
Déposez le sur le bureau par exemple.
Glisser-déposer l'icône d'un document Pages sur celle du script
va éliminer tous les Hyperliens et signets prédsents dans le document.
On peut également qlisser déposer un fichier index.xml.+++++++
Save the script as an Application or an Application Bundle: remove links.app
Store it on the desktop for instance.
Drag and drop the icon of a Pages document on the script's icon
to remove the Hyperlinks and Bookmarks embedded in the document.
We may also drag & drop an index.xml file.Yvan KOENIG (Vallauris, FRANCE)
16 février 2009
enhanced 17 février 2009
*)
--=====property removeBookmarks : true
(*
true = remove the bookmarks
false = don't remove the bookmarks *)
property removeLinks : true
(*
true = remove the Links
false = don't remove the Links *)
property liste : {}--=====
on open (sel)
set theDoc to (item 1 of sel) as text
tell application "System Events" to tell disk item theDoc
set nn to name
set uti to type identifier
set isPackage to package folder
end tellif nn is "index.xml" then
my traiteIndex(theDoc)
else if uti is not in {"com.apple.iwork.Pages.Pages", "com.apple.iwork.pages.sffpages"} then
error "Not a Pages document !"
else if isPackage then
-- here the document is a package
if theDoc ends with ":" then set theDoc to text 1 thru -2 of theDoc
tell application "Finder"
set the_index to (theDoc & ":index.xml")
set indexGzAvailable to exists file (the_index & ".gz")
set indexAvailable to exists file the_index
end tell -- Finder
if indexGzAvailable then
if indexAvailable then tell application "Finder" to delete file the_index
my expandIndex(the_index & ".gz")
my traiteIndex(the_index)
else
if indexAvailable then
my traiteIndex(the_index)
else
error "No Index available !"
end if
end if -- indexGzAvailable
else
-- here the document is a flat one
tell application "Finder"
set cont to (container of file theDoc) as text
set name of file theDoc to (nn & ".zip")
end tell -- Finder
set theDocZ to cont & nn & ".zip"
my expandDoc(theDocZ, theDoc)
tell application "Finder"
set name of file theDoc to (nn & "yk")
set theDocF to cont & nn & "yk"
set the_index to (theDocF & ":index.xml")
set indexAvailable to exists file the_index
end tell -- Finder
if indexAvailable then my traiteIndex(the_index)
end if -- nn …
end open--=====
on traiteIndex(theIndex)
local theKey1, theKey2, theKey3, theKey4, theKey5, itm, itm1, itm2, itm2
my nettoie()
(* Lis le contenu du fichier Index.xml *)
set texte to read file theIndex from 1if removeBookmarks then
(* supprime les descripteurs de signets *)
set theKey1 to "<sf:bookmark sf:name"
set theKey2 to "</sf:bookmark>"
if texte contains theKey1 then
set my liste to my decoupe(texte, theKey1)
repeat with i from 2 to count of my liste
set itm to my decoupe(item i of my liste, theKey2)
set itm1 to item 1 of itm
set itm1 to text (1 + (offset of ">" in itm1)) thru -1 of itm1
set itm2 to my recolle(items 2 thru -1 of itm, theKey2)
set item i of my liste to (itm1 & itm2)
end repeat -- i
set texte to my recolle(my liste, "")
end if
end if -- removeBookmarks
(*
Here are samples of Hyperlinks in the index.xml file
--link to bookmark
<sf:p sf:style="paragraph-style-32">
<sf:bookmark sf:name="page 3" sf:ranged="true" sf:page="3">
page 3
</sf:bookmark>
<sf:br/>--link to URL
<sf:p sf:style="paragraph-style-32">
<sf:link href="http://discussions.apple.com/thread.jspa?threadID=1905618&tstart=0" sf:style="SFWPCharacterStyle-7">
<sf:span sf:style="SFWPCharacterStyle-7">
Change cell color if number is different from previous cell
</sf:span>
</sf:link>
<sf:br/>--link to an other Pages document
<sf:p sf:style="paragraph-style-32">
<sf:link href="pages:///Users/yvan_koenig/Documents/Sans%20titre%20-%20copie.pages#un%20 signet%20externe">
<sf:file-alias sf:file-alias="0000000001ae000200010c4d6163696e746f7368204844000000000000000000 000000000000c45c8cef482b00000008a77c1853616e73207469747265202d20636f7069652e7061 67657300000000000000000000000000000000000000000000000000000000000000000000000000 000000360f06c5c03419000000000000000000010002000009200000000000000000000000000000 0009446f63756d656e747300001000080000c45c70cf0000001100080000c5c0260900000001000c 0008a77c0008a76f00006bdf000200414d6163696e746f73682048443a55736572733a7976616e5f 6b6f656e69673a446f63756d656e74733a53616e73207469747265202d20636f7069652e70616765 7300000e0032001800530061006e00730020007400690074007200650020002d00200063006f0070 00690065002e00700061006700650073000f001a000c004d006100630069006e0074006f00730068 0020004800440012003455736572732f7976616e5f6b6f656e69672f446f63756d656e74732f5361 6e73207469747265202d20636f7069652e7061676573001300012f00001500020012ffff0000"/>
<sf:span sf:style="SFWPCharacterStyle-7">
vers autre document
</sf:span>
</sf:link>
<sf:br/>
*)
if removeLinks then
(* supprime les descripteurs de liens *)
set theKey1 to "<sf:link href="
set theKey3 to "<sf:span sf:style="
set theKey4 to "</sf:link>"
set theKey5 to "</sf:span>"
if texte contains theKey1 then
set my liste to my decoupe(texte, theKey1)
repeat with i from 2 to count of my liste
set itm to my decoupe(item i of my liste, theKey4)
set itm1 to item 2 of my decoupe(item 1 of itm, theKey3)
set itm1 to text (1 + (offset of ">" in itm1)) thru -1 of itm1
set itm1 to item 1 of my decoupe(itm1, theKey5)
set itm2 to my recolle(items 2 thru -1 of itm, theKey4)
set item i of my liste to (itm1 & itm2)
end repeat -- i
set texte to my recolle(my liste, "")
end if -- texte contains
(*
This piece of code takes care of a bug in the save as Pages '08 process.
A link to an other document is not completely disabled so the 'disabled' link remains blue.
The link is stored this way:
<sf:p sf:style="paragraph-style-32">
<sf:span sf:style="SFWPCharacterStyle-7">vers autre document</sf:span>
<sf:br/>when it would be:
<sf:p sf:style="paragraph-style-32">
vers autre document
<sf:br/>
*)
if texte contains theKey3 then
set my liste to my decoupe(texte, theKey3)
repeat with i from 2 to count of my liste
set itm to my decoupe(item i of my liste, theKey5)
set itm1 to item 1 of itm
set itm1 to text (1 + (offset of ">" in itm1)) thru -1 of itm1
set itm2 to my recolle(items 2 thru -1 of itm, theKey5)
set item i of my liste to (itm1 & itm2)
end repeat -- i
set texte to my recolle(my liste, "")
end if -- texte contains
end if -- removeLinksset lineFeed to ASCII character 10
if texte contains (lineFeed & lineFeed) then set texte to my recolle(my decoupe(texte, lineFeed & lineFeed), lineFeed)
if texte contains (return & return) then set texte to my recolle(my decoupe(texte, return & return), return)set eof of file theIndex to 0
write texte to file theIndexmy nettoie()
end traiteIndex--=====
on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe--=====
on recolle(l, d)
local t
set AppleScript's text item delimiters to d
set t to l as text
set AppleScript's text item delimiters to ""
return t
end recolle--=====
on nettoie()
set liste to {}
end nettoie--=====
(* Expands the zip file z in the container d, z and d are pathnames as strings *)
on expandDoc(z, d)
do shell script "unzip " & quoted form of (POSIX path of (z)) & " -d " & quoted form of (POSIX path of (d))
end expandDoc--=====
on expandIndex(f)
do shell script "gunzip " & quoted form of (POSIX path of (f))
end expandIndex--=====
on lisIndex_xml(f)
local t
try
set t to ""
set t to (read file f)
end try
return t
end lisIndex_xml--=====
on compactIndex(nDoc)
local aliasNDoc
set aliasNDoc to nDoc as alias
write leTexte to aliasNDoc starting at 0
do shell script "gzip " & quoted form of POSIX path of aliasNDoc
end compactIndex--=====
--[/SCRIPT](code}Here is the bug report:
Your tracking number for this issue is Bug ID# 6594023.
When Pages '09 saves as Pages '08 a document containing a link to an other Pages document, it doesn't correctly remove the link.
The original link descriptor is:
<sf:p sf:style="paragraph-style-32">
<sf:link href="pages:///Users/yvan_koenig/Documents/Sans%20titre%20-%20copie.pages#un%20 signet%20externe">
<sf:file-alias sf:file-alias="0000000001ae000200010c4d6163696e746f7368204844000000000000000000 000000000000c45c8cef482b00000008a77c1853616e73207469747265202d20636f7069652e7061 67657300000000000000000000000000000000000000000000000000000000000000000000000000 000000360f06c5c03419000000000000000000010002000009200000000000000000000000000000 0009446f63756d656e747300001000080000c45c70cf0000001100080000c5c0260900000001000c 0008a77c0008a76f00006bdf000200414d6163696e746f73682048443a55736572733a7976616e5f 6b6f656e69673a446f63756d656e74733a53616e73207469747265202d20636f7069652e70616765 7300000e0032001800530061006e00730020007400690074007200650020002d00200063006f0070 00690065002e00700061006700650073000f001a000c004d006100630069006e0074006f00730068 0020004800440012003455736572732f7976616e5f6b6f656e69672f446f63756d656e74732f5361 6e73207469747265202d20636f7069652e7061676573001300012f00001500020012ffff0000"/>
<sf:span sf:style="SFWPCharacterStyle-7">vers autre document</sf:span>
</sf:link>
<sf:br/>The export process removes the sf:link items but fails to remove the sf:span ones
<sf:p sf:style="paragraph-style-32">
<sf:br/>
</sf:p>
<sf:p sf:style="paragraph-style-32">
<sf:span sf:style="SFWPCharacterStyle-7">vers autre document</sf:span>
<sf:br/>
</sf:p>when a correct one would be:
<sf:p sf:style="paragraph-style-32">
<sf:br/>
</sf:p>
<sf:p sf:style="paragraph-style-32">
vers autre document
<sf:br/>
</sf:p>Given that, the disconnected link remains blue in the exported document.
Yvan KOENIG (from FRANCE mardi 17 février 2009 15:20:22)