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
(「 CHM へのリンク - いくつかの注意事項」を参照)
このリンクは IE で開きます (HTML ヘルプ ビューアを右クリックすると、プロパティの下にあるこのリンクの場所が表示されます)。
もう 1 つのオプションは、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
chm ファイル内のページのアドレスを見つけるには、ページ (コンテンツ ツリーのリンクではなくページ自体) をリッチクリックし、[プロパティ] を選択する必要があります。「アドレス (URL)」の下に、探しているものが見つかります。
mk:@MSITStore:D:\Tools\Foo\Bar.chm::/help/base/index.html
良い点: プロパティ シートのテキストをマウスで選択してコピーできます ;-)
これが機能するためにどのように URL を単語に挿入する必要があるかについては、私にはわかりませんが、短い試行錯誤でそこにたどり着くはずです。
ファイルへのハイパーリンクを設定し、「#」ヘッダーアンカーを使用することでそれを行うことができるはずです(それが何と呼ばれているのかわかりません...)が、ここに例があります:
C:\Helpfiles\Help.chm#Topic