From 7c72f87708b1c416685635684df6b01df14ec538 Mon Sep 17 00:00:00 2001 From: Sam Ramon <15154970+samantharamon@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:15:12 -0700 Subject: [PATCH] [All hosts] (dialog) Add code snippet (#2116) * Add snippet to messageChild * Apply suggestion from review --- docs/code-snippets/office-snippets.yaml | 16 ++++++++++++ .../office/office/office.dialog.yml | 26 +++++++++++++++++++ .../office_release/office/office.dialog.yml | 26 +++++++++++++++++++ generate-docs/API Coverage Report.csv | 2 +- .../script-inputs/local-repo-snippets.yaml | 16 ++++++++++++ 5 files changed, 85 insertions(+), 1 deletion(-) diff --git a/docs/code-snippets/office-snippets.yaml b/docs/code-snippets/office-snippets.yaml index dcc8c345a5..bae8f002db 100644 --- a/docs/code-snippets/office-snippets.yaml +++ b/docs/code-snippets/office-snippets.yaml @@ -1817,6 +1817,22 @@ Office.Dialog#close:member(1): }); } ); +Office.Dialog#messageChild:member(1): + - |- + // The following example shows how to send information about the current active worksheet to the dialog. + await Excel.run(async (context) => { + const worksheet = context.workbook.worksheets.getActiveWorksheet(); + worksheet.load(); + await context.sync(); + worksheetPropertiesChanged(worksheet); + }); + + ... + + function worksheetPropertiesChanged(currentWorksheet) { + const messageToDialog = JSON.stringify(currentWorksheet); + dialog.messageChild(messageToDialog); + } Office.DialogOptions#height:member: - |- // The following example shows how to open a dialog with a specified size. It also shows diff --git a/docs/docs-ref-autogen/office/office/office.dialog.yml b/docs/docs-ref-autogen/office/office/office.dialog.yml index dd94ed9eb4..9f01ee0115 100644 --- a/docs/docs-ref-autogen/office/office/office.dialog.yml +++ b/docs/docs-ref-autogen/office/office/office.dialog.yml @@ -172,6 +172,32 @@ methods: Although classic Outlook on Mac doesn't support Mailbox 1.9, it does support DialogApi 1.2. + + + #### Examples + + + ```TypeScript + + // The following example shows how to send information about the current active worksheet to the dialog. + + await Excel.run(async (context) => { + const worksheet = context.workbook.worksheets.getActiveWorksheet(); + worksheet.load(); + await context.sync(); + worksheetPropertiesChanged(worksheet); + }); + + + ... + + + function worksheetPropertiesChanged(currentWorksheet) { + const messageToDialog = JSON.stringify(currentWorksheet); + dialog.messageChild(messageToDialog); + } + + ``` isPreview: false isDeprecated: false syntax: diff --git a/docs/docs-ref-autogen/office_release/office/office.dialog.yml b/docs/docs-ref-autogen/office_release/office/office.dialog.yml index dd94ed9eb4..9f01ee0115 100644 --- a/docs/docs-ref-autogen/office_release/office/office.dialog.yml +++ b/docs/docs-ref-autogen/office_release/office/office.dialog.yml @@ -172,6 +172,32 @@ methods: Although classic Outlook on Mac doesn't support Mailbox 1.9, it does support DialogApi 1.2. + + + #### Examples + + + ```TypeScript + + // The following example shows how to send information about the current active worksheet to the dialog. + + await Excel.run(async (context) => { + const worksheet = context.workbook.worksheets.getActiveWorksheet(); + worksheet.load(); + await context.sync(); + worksheetPropertiesChanged(worksheet); + }); + + + ... + + + function worksheetPropertiesChanged(currentWorksheet) { + const messageToDialog = JSON.stringify(currentWorksheet); + dialog.messageChild(messageToDialog); + } + + ``` isPreview: false isDeprecated: false syntax: diff --git a/generate-docs/API Coverage Report.csv b/generate-docs/API Coverage Report.csv index 5244f64ee2..69c6b76b8b 100644 --- a/generate-docs/API Coverage Report.csv +++ b/generate-docs/API Coverage Report.csv @@ -6815,7 +6815,7 @@ Office.DevicePermissionType,"microphone",EnumField,Fine,false Office.Dialog,N/A,Class,Good,false Office.Dialog,"addEventHandler(eventType, handler)",Method,Fine,true Office.Dialog,"close()",Method,Good,true -Office.Dialog,"messageChild(message, messageOptions)",Method,Fine,false +Office.Dialog,"messageChild(message, messageOptions)",Method,Fine,true Office.Dialog,"sendMessage(name)",Method,Poor,false Office.DialogMessageOptions,N/A,Class,Good,false Office.DialogMessageOptions,"targetOrigin",Property,Good,false diff --git a/generate-docs/script-inputs/local-repo-snippets.yaml b/generate-docs/script-inputs/local-repo-snippets.yaml index 5c27d37ac5..8c84e95f82 100644 --- a/generate-docs/script-inputs/local-repo-snippets.yaml +++ b/generate-docs/script-inputs/local-repo-snippets.yaml @@ -3358,6 +3358,22 @@ Office.Dialog#close:member(1): }); } ); +Office.Dialog#messageChild:member(1): + - |- + // The following example shows how to send information about the current active worksheet to the dialog. + await Excel.run(async (context) => { + const worksheet = context.workbook.worksheets.getActiveWorksheet(); + worksheet.load(); + await context.sync(); + worksheetPropertiesChanged(worksheet); + }); + + ... + + function worksheetPropertiesChanged(currentWorksheet) { + const messageToDialog = JSON.stringify(currentWorksheet); + dialog.messageChild(messageToDialog); + } Office.DialogOptions#height:member: - |- // The following example shows how to open a dialog with a specified size. It also shows