4

有没有办法从 Microsoft Word docx 文档链接到 chm 文件,并在其中链接到某个主题?类似的东西:

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

4

3 回答 3

2

我不认为仅仅一个指向 .chm 文件的文件链接就可以完成这项工作。

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

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

编辑

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

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

(请参阅 链接到 CHM - 一些注释

此链接将在 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
于 2008-11-26T14:10:05.813 回答
0

为了在 chm 文件中找到页面的地址,您需要右键单击页面(页面本身,而不是内容树中的链接)并选择“属性”。在“地址(URL)”下,您可以找到您要查找的内容,例如

mk:@MSITStore:D:\Tools\Foo\Bar.chm::/help/base/index.html

好消息:您可以用鼠标选择属性表中的文本并复制它;-)

至于如何将 URL 插入 word 中以使其正常工作,我不知道,但一个简短的试验和错误应该可以让你到达那里。

于 2008-11-26T14:17:40.990 回答
0

您应该可以通过设置文件的超链接并使用“#”标题锚来做到这一点(我不确定它叫什么......)但这里有一个例子:

C:\Helpfiles\Help.chm#Topic
于 2008-11-21T23:06:56.747 回答