{"id":565,"date":"2016-05-17T12:44:41","date_gmt":"2016-05-17T10:44:41","guid":{"rendered":"http:\/\/blogs.msdn.microsoft.com\/lavanack\/?p=565"},"modified":"2022-05-30T13:51:41","modified_gmt":"2022-05-30T11:51:41","slug":"docx-hypertext-links","status":"publish","type":"post","link":"https:\/\/laurentvanacker.com\/index.php\/2016\/05\/17\/docx-hypertext-links\/","title":{"rendered":"Lister et tester les liens Hypertexte dans un document Word \/ List and test Hypertext links in a Word document"},"content":{"rendered":"<div id=\"fr-FR\"><a href=\"#en-US\">English version<\/a><\/div>\n<p><span id=\"result_box\" lang=\"en\">[MAJ 09\/03\/2017] <\/span>En tant que PFE, je suis amen\u00e9 \u00e0 \u00e9crire beaucoup de documentations \u00e0 destination des clients. Il m&rsquo;arrive m\u00eame de devoir \u00e9crire des supports de formations. Souvent le cycle de vie de cette documentation s&rsquo;\u00e9tend sur plusieurs ann\u00e9es et m&rsquo;am\u00e8ne \u00e0 proc\u00e8der r\u00e9guli\u00e8rement \u00e0 des mises \u00e0 jour. Or toute bonne documentation renvoie forc\u00e9ment vers des liens connexes et rien n&rsquo;est plus fastidieux que de devoir valider les liens un par un pour savoir s&rsquo;ils sont toujours valides (Surtout quand le document\/formation comprend plusieurs centaines de liens hypertextes). Pour cela j&rsquo;ai d\u00e9velopp\u00e9 le script <a href=\"https:\/\/github.com\/lavanack\/laurentvanacker.com\/blob\/master\/Windows%20Powershell\/Office\/Word\/Get-WordHyperLinks.ps1\" target=\"_blank\" rel=\"noopener noreferrer\">suivant<\/a> qui liste tous les liens hypertextes pr\u00e9sent dans un ou plusieurs documents Word (Nom du document, Page, URI, Texte du lien) et indique de mani\u00e8re optionelle le statut HTTP du lien ainsi que le titre de la page en question. Le script est disponible <a href=\"https:\/\/github.com\/lavanack\/laurentvanacker.com\/blob\/master\/Windows%20Powershell\/Office\/Word\/Get-WordHyperLinks.ps1\" target=\"_blank\" rel=\"noopener noreferrer\">ici<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p>Le r\u00e9sultat sera un fichier CSV similaire \u00e0 celui-ci :<\/p>\n<p><a href=\"http:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1115\" src=\"http:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks.png\" alt=\"Get-WordHyperLinks\" width=\"1245\" height=\"197\" srcset=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks.png 1245w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks-300x47.png 300w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks-768x122.png 768w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks-1024x162.png 1024w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks-1200x190.png 1200w\" sizes=\"auto, (max-width: 1245px) 100vw, 1245px\" \/><\/a><\/p>\n<p>Ci-apr\u00e8s la signification des colonnes :<\/p>\n<ul>\n<li>TextToDisplay : Le texte du lien tel qu&rsquo;affich\u00e9 dans le document<\/li>\n<li>StatusCode : Le statut de la r\u00e9ponse HTTP<\/li>\n<li>Page : La page o\u00f9 se trouve le lien dans le document<\/li>\n<li>Document : Le chemin complet du document Word<\/li>\n<li>Title : Le titre de la page HTTP (balise HTML &lt;title&gt;&lt;\/title&gt;)<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<hr \/>\n<div id=\"en-US\"><a href=\"#fr-FR\">Version fran\u00e7aise<\/a><\/div>\n<div id=\"gt-form-c\">\n<form id=\"gt-form\" action=\"\/\" method=\"post\" name=\"text_form\">\n<blockquote>\n<div dir=\"ltr\"><span id=\"result_box\" lang=\"en\">\u00a0<\/span><\/div>\n<\/blockquote>\n<div id=\"gt-res-data\" dir=\"ltr\">\n<div id=\"gt-res-content\" class=\"almost_half_cell\">\n<div dir=\"ltr\"><span id=\"result_box\" lang=\"en\">[Updated 03\/09\/2017] As PFE, I have to write a lot of documentation from customers. I even have to write training materials. Often the life cycle of this material extends over several years and brings me to proceed to regular updates. But good documentation necessarily refers to related links and nothing is more tedious than having to validate the links one by one to see if they are still valid (Especially when the document \/ training includes hundreds of hyperlinks). For this I developed the following <a href=\"https:\/\/github.com\/lavanack\/laurentvanacker.com\/blob\/master\/Windows%20Powershell\/Office\/Word\/Get-WordHyperLinks.ps1\" target=\"_blank\" rel=\"noopener noreferrer\">script<\/a> that lists all hyperlinks present in one or more Word documents (Document name, Page, URI, text link) and so indicates optional HTTP status and the page title of the URI. The script is available <a href=\"https:\/\/github.com\/lavanack\/laurentvanacker.com\/blob\/master\/Windows%20Powershell\/Office\/Word\/Get-WordHyperLinks.ps1\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<br \/>\n<\/span><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<p dir=\"ltr\">The result will be a CSV file similar to this one:<\/p>\n<p dir=\"ltr\"><a href=\"http:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1115\" src=\"http:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks.png\" alt=\"Get-WordHyperLinks\" width=\"1245\" height=\"197\" srcset=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks.png 1245w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks-300x47.png 300w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks-768x122.png 768w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks-1024x162.png 1024w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2016\/07\/Get-WordHyperLinks-1200x190.png 1200w\" sizes=\"auto, (max-width: 1245px) 100vw, 1245px\" \/><\/a><\/p>\n<p dir=\"ltr\">Below the meaning of the columns:<\/p>\n<div dir=\"ltr\">\n<ul>\n<li>TextToDisplay: The link text as displayed in the document<\/li>\n<li>StatusCode: The status of the HTTP response<\/li>\n<li>Page: The page where the link in the document was found<\/li>\n<li>Document: Full file path of the Word document<\/li>\n<li>Title: The title of the HTTP page (HTML &lt;title&gt;&lt;\/title&gt;)<\/li>\n<\/ul>\n<\/div>\n<p>Laurent.<\/p>\n<\/form>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>English version [MAJ 09\/03\/2017] En tant que PFE, je suis amen\u00e9 \u00e0 \u00e9crire beaucoup de documentations \u00e0 destination des clients. Il m&rsquo;arrive m\u00eame de devoir [&#8230;]<\/p>\n","protected":false},"author":2,"featured_media":2463,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,13],"tags":[31,39,46],"class_list":["post-565","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","category-word","tag-office","tag-powershell","tag-word"],"_links":{"self":[{"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/posts\/565","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/comments?post=565"}],"version-history":[{"count":7,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/posts\/565\/revisions"}],"predecessor-version":[{"id":2885,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/posts\/565\/revisions\/2885"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/media\/2463"}],"wp:attachment":[{"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/media?parent=565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/categories?post=565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/tags?post=565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}