Ms word 如何从Word 2007文档链接到chm文件主题?

Ms word 如何从Word 2007文档链接到chm文件主题?,ms-word,docx,chm,Ms Word,Docx,Chm,有没有办法从Microsoft Word docx文档链接到chm文件,并在其中链接到某个主题?类似于: 有关此属性的详细信息,请参见[link ref=“./SomeDirectory/somedocument.chm!Sometopic.Somesubtopic”text=“MyClass.MyProperty”] 您应该能够通过设置文件的超链接并使用“#”标题锚(我不确定它叫什么…)来实现这一点,但下面是一个示例: C:\Helpfiles\Help.chm#Topic 我不认为仅仅是一

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

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


您应该能够通过设置文件的超链接并使用“#”标题锚(我不确定它叫什么…)来实现这一点,但下面是一个示例:

C:\Helpfiles\Help.chm#Topic

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

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

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

编辑

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

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

(见 )

此链接将在IE中打开(在HTML帮助查看器中单击鼠标右键可在“属性”下查看此链接的位置)

另一个选项是插入一个宏按钮,并让宏打开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

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

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

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


至于如何在word中插入URL以使其正常工作,我不知道,但一个简短的尝试和错误应该会让您达到目的。

WAG here.…2007是否仍然提供对象链接和嵌入(OLE)功能作为一个插入选项?但如何获取主题的名称?它们嵌套在chm.C:\Helpfiles\Help.chm\MyClassName中。在右侧的chm文件中,我有一个主题树(注意:不是列表)。现在只提供树节点的名称(例如C:\Helpfiles\Help.chm\mysubtopic)不会产生预期的结果。但是#MyMainTopic/MySubTopic/MySubSubTopic也不起作用。我需要找到topicname。在这种情况下,chm文件必须位于一个静态位置,因为指定了绝对路径,所以永远不会更改。如果有办法指定相对路径会更好。在我的场景中文件夹已交付给同时包含.chm和.docx的客户。好的,只需将绝对路径替换为相对路径:mk:@MSITStore:…\chm\Bar.chm::/help/base/index.html。我怀疑您无论如何都不需要“mk:@MSITStore:”部分。出于安全原因,我不允许使用宏。mk:@MSITStore:C:\SomeDirectory\help.chm::/helpa但是,ge.htm链接工作正常。只有一个问题:我无法指定绝对路径,而是必须使用相对路径(chm和docx始终位于同一文件夹中)。