将 Excel 或 Numbers (mac) 超链接转换为 html a 标签

Convert Excel or Numbers (mac) hyperlink to html a tags

我正在尝试将 Excel、Word 或 Numbers 超链接转换为 HTML <a> 标签。

例如,我有 [linkName] 并且需要 <a href='URL'>[linkName]</a>.

有什么想法吗?谢谢。

经过艰苦的研究,我找到了一个有效的答案,在 word 或 excel 你可以创建一个新的宏,然后 运行 它。

要创建宏,请转至 'view->macros' 创建一个新宏并粘贴此代码:

Sub AddHREF()
' Turn Word hyperlinks into <a href...> HTML tags
Dim i As Integer
For i = ActiveDocument.Hyperlinks.Count To 1 Step -1
  With ActiveDocument.Hyperlinks(i)
   If InStr(1, .Address, "http://www.gaebler.com", 1) Then
      .Range = "<a href=""" & Replace(.Address, "http://www.gaebler.com", "") & """>" _
      & Replace(Replace(.TextToDisplay, "<strong>", ""), "</strong>", "") & "</a>"
   Else
      .Range = "<a href=""" & .Address & """ target=""_blank"" rel=""nofollow"">" & _
      Replace(Replace(.TextToDisplay, "<strong>", ""), "</strong>", "") & "</a>"
   End If
  End With
    Next i
End Sub

然后 运行 宏和魔法出现了!