このトピックでは、テキストドキュメントを使用する場合に、ハイパーリンクを取得する方法と、指定した場所にハイパーリンクを挿入する方法について説明します。
ハイパーリンクの取得
ドキュメント内のすべてのハイパーリンクを取得します。
構文
Expression.ActiveDocument.Hyperlinks
Expression: ドキュメントタイプのアプリケーションオブジェクト。
例
async function example() { await instance.ready(); const app = instance.Application; // ハイパーリンクオブジェクトを取得します。 const hyperlinks = await app.ActiveDocument.Hyperlinks; }
ハイパーリンクの挿入
指定した場所にハイパーリンクを挿入します。
構文
Expression.ActiveDocument.Hyperlinks.Add({ Address, TextToDisplay })
Expression: ドキュメントタイプのアプリケーションオブジェクト。
パラメーター
パラメーター
タイプ
必須
説明
Address
String
はい
挿入するハイパーリンクのアドレス。
TextToDisplay
String
いいえ
ハイパーリンクの表示テキスト。
例
async function example() { await instance.ready(); const app = instance.Application; // 指定した場所にハイパーリンクを挿入します。 await app.ActiveDocument.Hyperlinks.Add({ Address: 'https://www.aliyun.com/', // 挿入するハイパーリンクのアドレス。 TextToDisplay: 'Alibaba Cloud公式ウェブサイト', // ハイパーリンクの表示テキスト。 }); }