有没有一种方法可以从Microsoft Word docx文档链接到chm文件以及其中的某个主题?符合以下条件的东西:


“有关此属性的更多信息,请参见[link ref =“ ./ SomeDirectory / somedocument.chm!Sometopic.Somesubtopic” text =“ MyClass.MyProperty”]

最佳答案

我不认为简单地指向.chm文件的文件链接就能完成这项工作。

对我来说,以下链接格式有效(请注意,.chm文件必须位于受信任的位置,默认情况下,网络共享将不起作用):

mk:@MSITStore:C:\ SomeDirectory \ help.chm :: / helppage.htm

编辑


对于相对路径,似乎
必须使用以下模式:

ms-its:。\ help.chm :: / html / main.htm

(看到
Linking to a CHM - Some Notes


该链接将在IE中打开(在HTML帮助查看器中右键单击以在属性下查看此链接的位置)。

另一种选择是插入MACROBUTTON并使用宏打开HTML帮助查看器。这将是VBA代码:

Declare Function HtmlHelp Lib "HHCtrl.ocx" Alias "HtmlHelpA" _
   (ByVal hwndCaller As Long, _
   ByVal pszFile As String, _
   ByVal uCommand As Long, _
   dwData As Any) As Long

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Public Function GetWindowHandle() As Long
    'obtain Word's hwnd
    'NOTE: there is a possibility of getting the wrong hwnd.  If two word windows
    'are open with the same caption, this *could* happen.  In order to prevent this,
    'you can either change the caption to something strange before trying to find it,
    'or you can compare processId's with GetCurrentProcessId and GetWindowThreadProcessId
    'You can always search the top level windows yourself.

    GetWindowHandle = FindWindow(Word8ClassName, ActiveDocument.Windows(1) & " - " & ActiveDocument.Application.Caption)

End Function

Public Function ShowHelp(strPage As String)

    On Error Resume Next

    HtmlHelp GetWindowHandle, "fullpathtohelpfile.chm", HH_DISPLAY_TOPIC, ByVal strPage

End Function

关于ms-word - 我如何链接到Word 2007文档中的chm文件主题?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/309153/

10-09 14:21